Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54850 - trunk/boost/fusion/adapted/boost_tuple
From: joel_at_[hidden]
Date: 2009-07-09 20:50:05


Author: djowel
Date: 2009-07-09 20:50:05 EDT (Thu, 09 Jul 2009)
New Revision: 54850
URL: http://svn.boost.org/trac/boost/changeset/54850

Log:
Fix #1601
Text files modified:
   trunk/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp | 36 ++++++++++++++++++++++++++++++++++++
   1 files changed, 36 insertions(+), 0 deletions(-)

Modified: trunk/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp
==============================================================================
--- trunk/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp (original)
+++ trunk/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp 2009-07-09 20:50:05 EDT (Thu, 09 Jul 2009)
@@ -14,6 +14,9 @@
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/eval_if.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>
 
 namespace boost { namespace fusion
@@ -91,6 +94,39 @@
                 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>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk