distance_impl.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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_DISTANCE_IMPL_09172005_0751)
  7. #define FUSION_DISTANCE_IMPL_09172005_0751
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/mpl/minus.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. struct vector_iterator_tag;
  13. namespace extension
  14. {
  15. template <typename Tag>
  16. struct distance_impl;
  17. template <>
  18. struct distance_impl<vector_iterator_tag>
  19. {
  20. template <typename First, typename Last>
  21. struct apply : mpl::minus<typename Last::index, typename First::index>
  22. {
  23. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  24. static typename mpl::minus<
  25. typename Last::index, typename First::index>::type
  26. call(First const&, Last const&)
  27. {
  28. typedef typename mpl::minus<
  29. typename Last::index, typename First::index>::type
  30. result;
  31. return result();
  32. }
  33. };
  34. };
  35. }
  36. }}
  37. #endif