Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73668 - in trunk/boost/fusion: algorithm/iteration/ext_ view/ext_
From: eric_at_[hidden]
Date: 2011-08-11 13:28:17


Author: eric_niebler
Date: 2011-08-11 13:28:17 EDT (Thu, 11 Aug 2011)
New Revision: 73668
URL: http://svn.boost.org/trac/boost/changeset/73668

Log:
segmented_fold_until should unpack the state's value before invoking the user's function
Text files modified:
   trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp | 4 ++--
   trunk/boost/fusion/view/ext_/segmented_fold_until.hpp | 8 ++++++--
   trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp | 1 -
   3 files changed, 8 insertions(+), 5 deletions(-)

Modified: trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp (original)
+++ trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp 2011-08-11 13:28:17 EDT (Thu, 11 Aug 2011)
@@ -23,7 +23,7 @@
         {
             typedef
                 fusion::result<
- typename result_of::fold<Range, typename State::value_type, Fun>::type,
+ typename result_of::fold<Range, State, Fun>::type,
                     continue_
>
             type;
@@ -37,7 +37,7 @@
         typename result<segmented_fold_fun(Range&, State const&, Context const&)>::type
         operator()(Range& rng, State const& state, Context const&) const
         {
- return fusion::fold(rng, state.value, fun);
+ return fusion::fold(rng, state, fun);
         }
 
         Fun const& fun;

Modified: trunk/boost/fusion/view/ext_/segmented_fold_until.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/segmented_fold_until.hpp (original)
+++ trunk/boost/fusion/view/ext_/segmented_fold_until.hpp 2011-08-11 13:28:17 EDT (Thu, 11 Aug 2011)
@@ -216,12 +216,16 @@
         struct segmented_fold_until_impl<Range, State, Context, Fun, false>
         {
             typedef
- typename boost::result_of<Fun(Range&, State const&, Context const&)>::type
+ typename boost::result_of<Fun(
+ Range&,
+ typename add_reference<typename add_const<typename State::value_type>::type>::type,
+ Context const&
+ )>::type
             type;
             
             static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
             {
- return fun(rng, state, context);
+ return fun(rng, state.value, context);
             }
         };
 

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 2011-08-11 13:28:17 EDT (Thu, 11 Aug 2011)
@@ -539,7 +539,6 @@
         };
     };
 
- // TODO: remove invocation of distance in iterator_range.
     // TODO: default implementation of begin, end, and size
     // should check if the sequence is segmented and to
     // the right thing.


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