distance_impl.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 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(BOOST_FUSION_DISTANCE_IMPL_20060223_0814)
  8. #define BOOST_FUSION_DISTANCE_IMPL_20060223_0814
  9. #include <boost/mpl/minus.hpp>
  10. namespace example
  11. {
  12. struct example_struct_iterator_tag;
  13. }
  14. namespace boost { namespace fusion {
  15. namespace extension
  16. {
  17. template<typename Tag>
  18. struct distance_impl;
  19. template<>
  20. struct distance_impl<example::example_struct_iterator_tag>
  21. {
  22. template<typename First, typename Last>
  23. struct apply
  24. : mpl::minus<typename Last::index, typename First::index>
  25. {
  26. typedef apply<First, Last> self;
  27. static typename self::type
  28. call(First const& first, Last const& last)
  29. {
  30. return typename self::type();
  31. }
  32. };
  33. };
  34. }
  35. }}
  36. #endif