From 01424b06b3a6c895b856afdf9750fd894e602966 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Sun, 10 Apr 2011 23:45:34 +0000 Subject: [PATCH] added version of fold (overload) accepting non-const State. [SVN r71179] --- .../algorithm/iteration/detail/fold.hpp | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index 56302fb8..cf92a354 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -404,7 +404,7 @@ namespace boost { namespace fusion , State const , F >::type - BOOST_FUSION_FOLD_NAME(Seq& seq,State const& state,F f) + BOOST_FUSION_FOLD_NAME(Seq& seq, State const& state, F f) { return result_of::BOOST_FUSION_FOLD_NAME::call( state, @@ -418,13 +418,41 @@ namespace boost { namespace fusion , State const , F >::type - BOOST_FUSION_FOLD_NAME(Seq const& seq,State const& state,F f) + BOOST_FUSION_FOLD_NAME(Seq const& seq, State const& state, F f) { return result_of::BOOST_FUSION_FOLD_NAME::call( state, fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq), f); } + + template + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME::call( + state, + fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq), + f); + } + + template + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq const + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME::call( + state, + fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq), + f); + } }} #undef BOOST_FUSION_FOLD_NAME