fusion::fold allows to take non-const lv-ref state properly.

This commit is contained in:
Kohei Takahashi
2015-09-08 15:14:27 +09:00
parent 1df7fc1dca
commit 76b7697ba5
11 changed files with 31 additions and 23 deletions

View File

@ -258,6 +258,22 @@ the first call) and [arg_desc] of `seq`.
typename result_of_name_macro<Sequence const, State const, F>::type name_macro(
Sequence const& seq, State const& initial_state, F f);
template<
typename Sequence,
typename State,
typename F
>
typename result_of_name_macro<Sequence, State, F>::type name_macro(
Sequence& seq, State& initial_state, F f);
template<
typename Sequence,
typename State,
typename F
>
typename result_of_name_macro<Sequence const, State, F>::type name_macro(
Sequence const& seq, State& initial_state, F f);
[def seq_concept_macro [seq_concept]]
[def arg_type_id_macro [arg_type_id]]
[def arg_id_macro [arg_id]]

View File

@ -68,9 +68,7 @@ namespace boost { namespace fusion
, typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<It>::type
, boost::result_of<
F(
typename add_reference<typename add_const<
typename State::type
>::type>::type,
typename add_reference<typename State::type>::type,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const)
)
>
@ -108,9 +106,7 @@ namespace boost { namespace fusion
typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<It>::type
, boost::result_of<
F(
typename add_reference<typename add_const<
typename State::type
>::type>::type,
typename add_reference<typename State::type>::type,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const)
)
>
@ -136,7 +132,7 @@ namespace boost { namespace fusion
, BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
)
, add_reference<typename add_const<State>::type>
, add_reference<State>
, F
>
{};
@ -150,7 +146,7 @@ namespace boost { namespace fusion
BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
)
, add_reference<typename add_const<State>::type>
, add_reference<State>
, F
>(
typename result_of::size<Seq>::type()
@ -199,7 +195,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq
, State const
, State
, F
>::type
BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f)
@ -211,7 +207,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq const
, State const
, State
, F
>::type
BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f)

View File

@ -22,7 +22,6 @@
#include <boost/fusion/iterator/next.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold<
Seq
, State const
, State
, F
>::type
fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold<
Seq const
, State const
, State
, F
>::type
fold(Seq const& seq, State& state, F f);

View File

@ -22,7 +22,6 @@
#include <boost/fusion/iterator/next.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_ITER_FOLD

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold<
Seq
, State const
, State
, F
>::type
iter_fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold<
Seq const
, State const
, State
, F
>::type
iter_fold(Seq const& seq, State& state, F f);

View File

@ -22,7 +22,6 @@
#include <boost/fusion/iterator/prior.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_REVERSE_FOLD

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold<
Seq
, State const
, State
, F
>::type
reverse_fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold<
Seq const
, State const
, State
, F
>::type
reverse_fold(Seq const& seq, State& state, F f);

View File

@ -21,7 +21,6 @@
#include <boost/fusion/iterator/prior.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_REVERSE_FOLD

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold<
Seq
, State const
, State
, F
>::type
reverse_iter_fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold<
Seq const
, State const
, State
, F
>::type
reverse_iter_fold(Seq const& seq, State& state, F f);

View File

@ -189,7 +189,7 @@ struct fold_test_n
>::type
, typename mpl::if_c<
!n
, mpl::vector<mpl::int_<1>, mpl::int_<0> > const&
, mpl::vector<mpl::int_<1>, mpl::int_<0> >&
, mpl::vector<mpl::int_<n+1>, mpl::int_<squares_sum> >
>::type
>