Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-14 11:36:15


Author: eric_niebler
Date: 2007-11-14 11:36:15 EST (Wed, 14 Nov 2007)
New Revision: 41093
URL: http://svn.boost.org/trac/boost/changeset/41093

Log:
fix support for segmented iteration
Text files modified:
   trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp | 2 +-
   trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp | 29 +++++++++++++++++++++--------
   trunk/libs/fusion/test/sequence/ext_/iterator_range_s.cpp | 4 ++--
   3 files changed, 24 insertions(+), 11 deletions(-)

Modified: trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp (original)
+++ trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp 2007-11-14 11:36:15 EST (Wed, 14 Nov 2007)
@@ -117,7 +117,7 @@
     private:
         static type call_(SegmentedRange const &range, mpl::true_)
         {
- return found::call(range, where::call(*range.where));
+ return found::call(range, where::call(*range.where_));
         }
 
         static type call_(SegmentedRange const &range, mpl::false_)

Modified: trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp (original)
+++ trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp 2007-11-14 11:36:15 EST (Wed, 14 Nov 2007)
@@ -12,6 +12,8 @@
 #include <boost/mpl/minus.hpp>
 #include <boost/mpl/next_prior.hpp>
 #include <boost/mpl/and.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/remove_reference.hpp>
 #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
 #include <boost/fusion/container/list/cons.hpp>
 #include <boost/fusion/view/joint_view.hpp>
@@ -124,26 +126,37 @@
             {}
 
             template<typename First, typename Second>
- struct result;
+ struct result_;
 
             template<typename Second>
- struct result<right_view, Second>
+ struct result_<right_view, Second>
             {
                 typedef segmented_view<right_view, RightCons> type;
             };
 
             template<typename Second>
- struct result<left_view, Second>
+ struct result_<left_view, Second>
             {
                 typedef segmented_view<left_view, LeftCons> type;
             };
 
             template<typename Second>
- struct result<full_view, Second>
+ struct result_<full_view, Second>
             {
                 typedef Second type;
             };
 
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename First, typename Second>
+ struct result<This(First, Second)>
+ : result_<
+ typename remove_cv<typename remove_reference<First>::type>::type
+ , typename remove_cv<typename remove_reference<Second>::type>::type
+ >
+ {};
+
             template<typename Second>
             segmented_view<right_view, RightCons> operator ()(right_view, Second &second) const
             {
@@ -226,7 +239,7 @@
 
                 static type call(Sequence &seq)
                 {
- return type(range(seq.cons.car.where, fusion::end(seq.cons.car.sequence)));
+ return type(range(seq.cons.car.where_, fusion::end(seq.cons.car.sequence)));
                 }
             };
         };
@@ -266,7 +279,7 @@
                             make_multiple_view<size_minus_1>(detail::full_view())
                           , make_single_view(detail::left_view())
                         )
- , segmented_range(fusion::begin(seq.cons.car.sequence), fusion::next(seq.cons.car.where))
+ , segmented_range(fusion::begin(seq.cons.car.sequence), fusion::next(seq.cons.car.where_))
                       , tfx(seq.cons.cdr)
                     );
                 }
@@ -284,7 +297,7 @@
 
                 static type call(Sequence &seq)
                 {
- return type(range(fusion::begin(seq.cons.car.sequence), seq.cons.car.where));
+ return type(range(fusion::begin(seq.cons.car.sequence), seq.cons.car.where_));
                 }
             };
         };
@@ -437,7 +450,7 @@
 
             static type call(cons<Car1> const &cons1, cons<Car2> const &cons2)
             {
- return type(range(cons1.car.where, cons2.car.where));
+ return type(range(cons1.car.where_, cons2.car.where_));
             }
         };
 

Modified: trunk/libs/fusion/test/sequence/ext_/iterator_range_s.cpp
==============================================================================
--- trunk/libs/fusion/test/sequence/ext_/iterator_range_s.cpp (original)
+++ trunk/libs/fusion/test/sequence/ext_/iterator_range_s.cpp 2007-11-14 11:36:15 EST (Wed, 14 Nov 2007)
@@ -43,8 +43,8 @@
     using namespace fusion;
     using mpl::_;
 
- typedef typename result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
- typedef typename result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
+ typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
 
     typedef iterator_range<short_iter, float_iter> slice_t;
     BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);


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