distance_impl.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_DISTANCE_IMPL_14122005_2104)
  8. #define FUSION_DISTANCE_IMPL_14122005_2104
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/iterator/distance.hpp>
  11. namespace boost { namespace fusion {
  12. struct reverse_view_iterator_tag;
  13. template <typename Iterator>
  14. struct reverse_view_iterator;
  15. namespace extension
  16. {
  17. template<typename Tag>
  18. struct distance_impl;
  19. template<>
  20. struct distance_impl<reverse_view_iterator_tag>
  21. {
  22. template<typename First, typename Last>
  23. struct apply
  24. {
  25. typedef typename First::first_type first_type;
  26. typedef typename Last::first_type last_type;
  27. typedef typename result_of::distance<last_type, first_type>::type type;
  28. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  29. static type
  30. call(First const& first, Last const& last)
  31. {
  32. return boost::fusion::distance(last.first, first.first);
  33. }
  34. };
  35. };
  36. }
  37. }}
  38. #endif