segmented_fold_until should unpack the state's value before invoking the user's function

[SVN r73668]
This commit is contained in:
Eric Niebler
2011-08-11 17:28:17 +00:00
parent 3af35683ff
commit b83a2954f5
3 changed files with 8 additions and 5 deletions

View File

@ -23,7 +23,7 @@ namespace boost { namespace fusion { namespace detail
{
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 @@ namespace boost { namespace fusion { namespace detail
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;

View File

@ -216,12 +216,16 @@ namespace boost { namespace fusion
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);
}
};

View File

@ -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.