reverse.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #if !defined(FUSION_REVERSE_07212005_1230)
  7. #define FUSION_REVERSE_07212005_1230
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/view/reverse_view/reverse_view.hpp>
  10. #include <boost/fusion/support/is_sequence.hpp>
  11. #include <boost/utility/enable_if.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. namespace result_of
  15. {
  16. template <typename Sequence>
  17. struct reverse
  18. {
  19. typedef reverse_view<Sequence> type;
  20. };
  21. }
  22. template <typename Sequence>
  23. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  24. inline typename
  25. enable_if<
  26. traits::is_sequence<Sequence>
  27. , reverse_view<Sequence const>
  28. >::type
  29. reverse(Sequence const& view)
  30. {
  31. return reverse_view<Sequence const>(view);
  32. }
  33. }}
  34. #endif