reverse.hpp 1.2 KB

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