1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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_09172005_0730)
8 #define FUSION_DISTANCE_09172005_0730
10 #include <boost/mpl/int.hpp>
11 #include <boost/mpl/if.hpp>
12 #include <boost/mpl/eval_if.hpp>
13 #include <boost/mpl/next.hpp>
14 #include <boost/mpl/identity.hpp>
15 #include <boost/fusion/iterator/next.hpp>
16 #include <boost/fusion/iterator/equal_to.hpp>
18 namespace boost { namespace fusion { namespace distance_detail
20 // Default distance implementation, linear
21 // search for the Last iterator.
23 template <typename First, typename Last>
24 struct linear_distance;
26 template <typename First, typename Last>
31 typename linear_distance<
32 typename result_of::next<First>::type
39 template <typename First, typename Last>
40 struct linear_distance
42 result_of::equal_to<First, Last>
43 , mpl::identity<mpl::int_<0> >
44 , next_distance<First, Last>
49 result_of::equal_to<First, Last>
50 , mpl::identity<mpl::int_<0> >
51 , next_distance<First, Last>
56 call(First const&, Last const&)