advance_impl.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_ADVANCE_IMPL_14122005_2015)
  8. #define FUSION_ADVANCE_IMPL_14122005_2015
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/iterator/advance.hpp>
  11. #include <boost/mpl/negate.hpp>
  12. namespace boost { namespace fusion {
  13. struct reverse_view_iterator_tag;
  14. template <typename Iterator>
  15. struct reverse_view_iterator;
  16. namespace extension
  17. {
  18. template<typename Tag>
  19. struct advance_impl;
  20. template<>
  21. struct advance_impl<reverse_view_iterator_tag>
  22. {
  23. template<typename Iterator, typename Dist>
  24. struct apply
  25. {
  26. typedef typename Iterator::first_type first_type;
  27. typedef typename mpl::negate<Dist>::type negative_dist;
  28. typedef typename result_of::advance<first_type, negative_dist>::type advanced_type;
  29. typedef reverse_view_iterator<advanced_type> type;
  30. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  31. static type
  32. call(Iterator const& i)
  33. {
  34. return type(boost::fusion::advance<negative_dist>(i.first));
  35. }
  36. };
  37. };
  38. }
  39. }}
  40. #endif