From 1df7fc1dcad0023693cb4065fd1dcc851ae858d1 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Tue, 8 Sep 2015 13:59:48 +0900 Subject: [PATCH] Revert "Remove unnecessary overloads, state should always be const." This reverts commit 9b77c26a24500a19612589ef54235f64ede41a40. As discussed on github, the original code was wrong. --- .../algorithm/iteration/detail/fold.hpp | 24 +++++++++++++++++++ .../fusion/algorithm/iteration/fold_fwd.hpp | 18 ++++++++++++++ .../algorithm/iteration/iter_fold_fwd.hpp | 18 ++++++++++++++ .../algorithm/iteration/reverse_fold_fwd.hpp | 18 ++++++++++++++ .../iteration/reverse_iter_fold_fwd.hpp | 18 ++++++++++++++ 5 files changed, 96 insertions(+) diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index 5c3ec765..22cb6ecd 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -194,6 +194,30 @@ namespace boost { namespace fusion { return detail::BOOST_FUSION_FOLD_NAME(seq, state, f); } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f) + { + return detail::BOOST_FUSION_FOLD_NAME(seq, state, f); + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + 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 detail::BOOST_FUSION_FOLD_NAME(seq, state, f); + } }} #undef BOOST_FUSION_FOLD_NAME diff --git a/include/boost/fusion/algorithm/iteration/fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/fold_fwd.hpp index 06dd6dda..f8328e80 100644 --- a/include/boost/fusion/algorithm/iteration/fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/fold_fwd.hpp @@ -33,6 +33,24 @@ namespace boost { namespace fusion , F >::type fold(Seq const& seq, State const& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::fold< + Seq + , State const + , F + >::type + fold(Seq& seq, State& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::fold< + Seq const + , State const + , F + >::type + fold(Seq const& seq, State& state, F f); }} #endif diff --git a/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp index e7b7f434..6c595cf1 100644 --- a/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp @@ -33,6 +33,24 @@ namespace boost { namespace fusion , F >::type iter_fold(Seq const& seq, State const& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::iter_fold< + Seq + , State const + , F + >::type + iter_fold(Seq& seq, State& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::iter_fold< + Seq const + , State const + , F + >::type + iter_fold(Seq const& seq, State& state, F f); }} #endif diff --git a/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp index f1dd8ac7..42c8ac21 100644 --- a/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp @@ -33,6 +33,24 @@ namespace boost { namespace fusion , F >::type reverse_fold(Seq const& seq, State const& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::reverse_fold< + Seq + , State const + , F + >::type + reverse_fold(Seq& seq, State& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::reverse_fold< + Seq const + , State const + , F + >::type + reverse_fold(Seq const& seq, State& state, F f); }} #endif diff --git a/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp index 6a60931d..21d99dee 100644 --- a/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp @@ -33,6 +33,24 @@ namespace boost { namespace fusion , F >::type reverse_iter_fold(Seq const& seq, State const& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::reverse_iter_fold< + Seq + , State const + , F + >::type + reverse_iter_fold(Seq& seq, State& state, F f); + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::reverse_iter_fold< + Seq const + , State const + , F + >::type + reverse_iter_fold(Seq const& seq, State& state, F f); }} #endif