| 1 | /*! |
| 2 | @file |
| 3 | Forward declares `boost::hana::reverse`. |
| 4 | |
| 5 | Copyright Louis Dionne 2013-2022 |
| 6 | Distributed under the Boost Software License, Version 1.0. |
| 7 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) |
| 8 | */ |
| 9 | |
| 10 | #ifndef BOOST_HANA_FWD_REVERSE_HPP |
| 11 | #define BOOST_HANA_FWD_REVERSE_HPP |
| 12 | |
| 13 | #include <boost/hana/config.hpp> |
| 14 | #include <boost/hana/core/when.hpp> |
| 15 | |
| 16 | |
| 17 | namespace boost { namespace hana { |
| 18 | //! Reverse a sequence. |
| 19 | //! @ingroup group-Sequence |
| 20 | //! |
| 21 | //! Specifically, `reverse(xs)` is a new sequence containing the same |
| 22 | //! elements as `xs`, except in reverse order. |
| 23 | //! |
| 24 | //! |
| 25 | //! @param xs |
| 26 | //! The sequence to reverse. |
| 27 | //! |
| 28 | //! |
| 29 | //! Example |
| 30 | //! ------- |
| 31 | //! @include example/reverse.cpp |
| 32 | #ifdef BOOST_HANA_DOXYGEN_INVOKED |
| 33 | constexpr auto reverse = [](auto&& xs) { |
| 34 | return tag-dispatched; |
| 35 | }; |
| 36 | #else |
| 37 | template <typename S, typename = void> |
| 38 | struct reverse_impl : reverse_impl<S, when<true>> { }; |
| 39 | |
| 40 | struct reverse_t { |
| 41 | template <typename Xs> |
| 42 | constexpr auto operator()(Xs&& xs) const; |
| 43 | }; |
| 44 | |
| 45 | BOOST_HANA_INLINE_VARIABLE constexpr reverse_t reverse{}; |
| 46 | #endif |
| 47 | }} // end namespace boost::hana |
| 48 | |
| 49 | #endif // !BOOST_HANA_FWD_REVERSE_HPP |
| 50 | |