distance_impl.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*=============================================================================
  2. Copyright (c) 2011 Eric Niebler
  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(BOOST_FUSION_SINGLE_VIEW_DISTANCE_IMPL_JUL_07_2011_1348PM)
  7. #define BOOST_FUSION_SINGLE_VIEW_DISTANCE_IMPL_JUL_07_2011_1348PM
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/mpl/minus.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. struct single_view_iterator_tag;
  13. namespace extension
  14. {
  15. template<typename Tag>
  16. struct distance_impl;
  17. template<>
  18. struct distance_impl<single_view_iterator_tag>
  19. {
  20. template<typename First, typename Last>
  21. struct apply
  22. : mpl::minus<typename Last::position, typename First::position>
  23. {
  24. typedef typename mpl::minus<typename Last::position,
  25. typename First::position>::type type;
  26. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  27. static type
  28. call(First const& /*first*/, Last const& /*last*/)
  29. {
  30. return type();
  31. }
  32. };
  33. };
  34. }
  35. }}
  36. #endif