[SVN r54850]
This commit is contained in:
Joel de Guzman
2009-07-10 00:50:05 +00:00
parent 14b27978e3
commit c0eebc8121

View File

@ -14,6 +14,9 @@
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp> #include <boost/mpl/eval_if.hpp>
#include <boost/mpl/or.hpp> #include <boost/mpl/or.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
@ -91,6 +94,39 @@ namespace boost { namespace fusion
return type(iter.cons.get_tail()); return type(iter.cons.get_tail());
} }
}; };
template <typename I1, typename I2>
struct distance;
// detail
template <typename I1, typename I2>
struct lazy_next_distance
{
typedef
typename mpl::plus<
mpl::int_<1>,
typename distance<
typename next<I1>::type,
I2
>::type
>::type type;
};
template <typename I1, typename I2>
struct distance
{
typedef typename mpl::eval_if<
boost::is_same<I1, I2>,
mpl::int_<0>,
lazy_next_distance<I1, I2>
>::type type;
static type
call(I1 const&, I2 const&)
{
return type();
}
};
}; };
template <typename Null> template <typename Null>