From b83a2954f5a1ed5b0886f4980395cd2a59a23681 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Thu, 11 Aug 2011 17:28:17 +0000 Subject: [PATCH] segmented_fold_until should unpack the state's value before invoking the user's function [SVN r73668] --- include/boost/fusion/algorithm/iteration/ext_/fold_s.hpp | 4 ++-- include/boost/fusion/view/ext_/segmented_fold_until.hpp | 8 ++++++-- .../boost/fusion/view/ext_/segmented_iterator_range.hpp | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/boost/fusion/algorithm/iteration/ext_/fold_s.hpp b/include/boost/fusion/algorithm/iteration/ext_/fold_s.hpp index 78d5d8e8..13908f97 100644 --- a/include/boost/fusion/algorithm/iteration/ext_/fold_s.hpp +++ b/include/boost/fusion/algorithm/iteration/ext_/fold_s.hpp @@ -23,7 +23,7 @@ namespace boost { namespace fusion { namespace detail { typedef fusion::result< - typename result_of::fold::type, + typename result_of::fold::type, continue_ > type; @@ -37,7 +37,7 @@ namespace boost { namespace fusion { namespace detail typename result::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; diff --git a/include/boost/fusion/view/ext_/segmented_fold_until.hpp b/include/boost/fusion/view/ext_/segmented_fold_until.hpp index 85392073..799da3cd 100644 --- a/include/boost/fusion/view/ext_/segmented_fold_until.hpp +++ b/include/boost/fusion/view/ext_/segmented_fold_until.hpp @@ -216,12 +216,16 @@ namespace boost { namespace fusion struct segmented_fold_until_impl { typedef - typename boost::result_of::type + typename boost::result_of::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); } }; diff --git a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp index 209faee5..57de282d 100644 --- a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp +++ b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp @@ -539,7 +539,6 @@ namespace boost { namespace fusion { namespace extension }; }; - // 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.