summaryrefslogtreecommitdiff
path: root/boost/fusion/algorithm/iteration
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fusion/algorithm/iteration')
-rw-r--r--boost/fusion/algorithm/iteration/accumulate.hpp10
-rw-r--r--boost/fusion/algorithm/iteration/accumulate_fwd.hpp8
-rw-r--r--boost/fusion/algorithm/iteration/detail/fold.hpp153
-rw-r--r--boost/fusion/algorithm/iteration/detail/for_each.hpp22
-rw-r--r--boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp138
-rw-r--r--boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp138
-rw-r--r--boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp138
-rw-r--r--boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp138
-rw-r--r--boost/fusion/algorithm/iteration/detail/segmented_fold.hpp6
-rw-r--r--boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp6
-rw-r--r--boost/fusion/algorithm/iteration/fold.hpp1
-rw-r--r--boost/fusion/algorithm/iteration/fold_fwd.hpp16
-rw-r--r--boost/fusion/algorithm/iteration/for_each.hpp10
-rw-r--r--boost/fusion/algorithm/iteration/for_each_fwd.hpp10
-rw-r--r--boost/fusion/algorithm/iteration/iter_fold.hpp2
-rw-r--r--boost/fusion/algorithm/iteration/iter_fold_fwd.hpp16
-rw-r--r--boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp16
-rw-r--r--boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp16
18 files changed, 458 insertions, 386 deletions
diff --git a/boost/fusion/algorithm/iteration/accumulate.hpp b/boost/fusion/algorithm/iteration/accumulate.hpp
index 430f9eb546..fe7112e323 100644
--- a/boost/fusion/algorithm/iteration/accumulate.hpp
+++ b/boost/fusion/algorithm/iteration/accumulate.hpp
@@ -26,9 +26,8 @@ namespace boost { namespace fusion
}
template <typename Sequence, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- inline
- typename
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence, State const, F>
@@ -39,9 +38,8 @@ namespace boost { namespace fusion
}
template <typename Sequence, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- inline
- typename
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence const, State const, F>
diff --git a/boost/fusion/algorithm/iteration/accumulate_fwd.hpp b/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
index 0633349825..50c4d39d4e 100644
--- a/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
+++ b/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
@@ -20,8 +20,8 @@ namespace boost { namespace fusion
}
template <typename Sequence, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence, State const, F>
@@ -29,8 +29,8 @@ namespace boost { namespace fusion
accumulate(Sequence& seq, State const& state, F f);
template <typename Sequence, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence const, State const, F>
diff --git a/boost/fusion/algorithm/iteration/detail/fold.hpp b/boost/fusion/algorithm/iteration/detail/fold.hpp
index 71f60a7c63..1813bd247a 100644
--- a/boost/fusion/algorithm/iteration/detail/fold.hpp
+++ b/boost/fusion/algorithm/iteration/detail/fold.hpp
@@ -47,7 +47,7 @@ namespace boost { namespace fusion
{
template<typename State, typename It, typename F>
struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)
- : boost::result_of<
+ : fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It))
@@ -57,39 +57,11 @@ namespace boost { namespace fusion
template<typename Result,int N>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)
{
- template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ template<typename State3, typename It3, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
- call(State const& state,It0 const& it0,F f)
+ call_3(State3 const& state3,It3 const& it3,F& f)
{
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0);
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It1
- >::type
- It2;
- It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1);
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It2
- >::type
- It3;
- It3 it3 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2);
-
- typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State,It0,F>::type State1;
- State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0));
-
- typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State1,It1,F>::type State2;
- State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1));
-
- typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State2,It2,F>::type State3;
- State3 const state3=f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2));
-
return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<
Result
, N-4
@@ -98,54 +70,95 @@ namespace boost { namespace fusion
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it3),
f);
}
+
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return call_3(
+ f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)),
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2),
+ f);
+ }
+
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)),
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1),
+ f);
+ }
+
+ template<typename State, typename It0, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call(State const& state,It0 const& it0,F f)
+ {
+ return call_1(
+ f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0),
+ f);
+ }
};
template<typename Result>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,3>
{
- template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
- call(State const& state,It0 const& it0,F f)
+ call_2(State2 const& state2,It2 const& it2,F& f)
{
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0);
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It1
- >::type
- It2;
- It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1);
-
- typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State,It0,F>::type State1;
- State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0));
+ return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2));
+ }
- typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State1,It1,F>::type State2;
- State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1));
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)),
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1),
+ f);
+ }
- return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2));
+ template<typename State, typename It0, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call(State const& state,It0 const& it0,F f)
+ {
+ return call_1(
+ f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0),
+ f);
}
};
template<typename Result>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,2>
{
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1));
+ }
+
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State,It0,F>::type State1;
- State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0));
-
- return f(
- state1,
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(
- fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0)));
+ return call_1(
+ f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0),
+ f);
}
};
@@ -153,7 +166,7 @@ namespace boost { namespace fusion
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,1>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
@@ -166,7 +179,7 @@ namespace boost { namespace fusion
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,0>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
@@ -314,7 +327,7 @@ namespace boost { namespace fusion
{
typedef typename
BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- typename boost::result_of<
+ typename fusion::detail::result_of_with_decltype<
F(
StateRef,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(
@@ -345,7 +358,7 @@ namespace boost { namespace fusion
>::type
type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
@@ -369,7 +382,7 @@ namespace boost { namespace fusion
{
typedef StateRef type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
@@ -404,7 +417,7 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq
, State const
@@ -419,7 +432,7 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq const
, State const
@@ -434,7 +447,7 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq
, State const
@@ -449,7 +462,7 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq const
, State const
diff --git a/boost/fusion/algorithm/iteration/detail/for_each.hpp b/boost/fusion/algorithm/iteration/detail/for_each.hpp
index 81b3ab7028..0bef5cec4a 100644
--- a/boost/fusion/algorithm/iteration/detail/for_each.hpp
+++ b/boost/fusion/algorithm/iteration/detail/for_each.hpp
@@ -21,14 +21,14 @@ namespace boost { namespace fusion {
namespace detail
{
template <typename First, typename Last, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline void
for_each_linear(First const&, Last const&, F const&, mpl::true_)
{
}
-
+
template <typename First, typename Last, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline void
for_each_linear(First const& first, Last const& last, F const& f, mpl::false_)
{
@@ -39,7 +39,7 @@ namespace detail
template <typename Sequence, typename F, typename Tag>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline void
for_each_dispatch(Sequence& seq, F const& f, Tag)
{
@@ -56,7 +56,7 @@ namespace detail
struct for_each_unrolled
{
template<typename I0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static void call(I0 const& i0, F const& f)
{
f(*i0);
@@ -77,7 +77,7 @@ namespace detail
struct for_each_unrolled<3>
{
template<typename I0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static void call(I0 const& i0, F const& f)
{
f(*i0);
@@ -94,7 +94,7 @@ namespace detail
struct for_each_unrolled<2>
{
template<typename I0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static void call(I0 const& i0, F const& f)
{
f(*i0);
@@ -108,7 +108,7 @@ namespace detail
struct for_each_unrolled<1>
{
template<typename I0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static void call(I0 const& i0, F const& f)
{
f(*i0);
@@ -119,14 +119,14 @@ namespace detail
struct for_each_unrolled<0>
{
template<typename It, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static void call(It const&, F const&)
{
}
};
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline void
for_each_dispatch(Sequence& seq, F const& f, random_access_traversal_tag)
{
@@ -136,7 +136,7 @@ namespace detail
}
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline void
for_each(Sequence& seq, F const& f, mpl::false_) // unsegmented implementation
{
diff --git a/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
index 140c70b1c2..bd3b1dbdac 100644
--- a/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
+++ b/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
@@ -14,7 +14,7 @@ namespace boost { namespace fusion
{
template<typename State, typename It, typename F>
struct fold_lvalue_state
- : boost::result_of<
+ : fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
typename fusion::result_of::deref<It>::type)
@@ -23,35 +23,11 @@ namespace boost { namespace fusion
template<typename Result,int N>
struct unrolled_fold
{
- template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ template<typename State3, typename It3, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
- call(State const& state,It0 const& it0,F f)
+ call_3(State3 const& state3,It3 const& it3,F& f)
{
- typedef typename
- result_of::next<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::next(it0);
- typedef typename
- result_of::next<
- It1
- >::type
- It2;
- It2 it2 = fusion::next(it1);
- typedef typename
- result_of::next<
- It2
- >::type
- It3;
- It3 it3 = fusion::next(it2);
- typedef typename fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,fusion::deref(it0));
- typedef typename fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,fusion::deref(it1));
- typedef typename fold_lvalue_state<State2,It2,F>::type State3;
- State3 const state3=f(state2,fusion::deref(it2));
return unrolled_fold<
Result
, N-4
@@ -60,54 +36,94 @@ namespace boost { namespace fusion
fusion::next(it3),
f);
}
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return call_3(
+ f(state2,fusion::deref(it2)),
+ fusion::next(it2),
+ f);
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,fusion::deref(it1)),
+ fusion::next(it1),
+ f);
+ }
+ template<typename State, typename It0, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call(State const& state,It0 const& it0,F f)
+ {
+ return call_1(
+ f(state,fusion::deref(it0)),
+ fusion::next(it0),
+ f);
+ }
};
template<typename Result>
struct unrolled_fold<Result,3>
{
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return f(state2,fusion::deref(it2));
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,fusion::deref(it1)),
+ fusion::next(it1),
+ f);
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename
- result_of::next<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::next(it0);
- typedef typename
- result_of::next<
- It1
- >::type
- It2;
- It2 it2 = fusion::next(it1);
- typedef typename fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,fusion::deref(it0));
- typedef typename fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,fusion::deref(it1));
- return f(state2,fusion::deref(it2));
+ return call_1(
+ f(state,fusion::deref(it0)),
+ fusion::next(it0),
+ f);
}
};
template<typename Result>
struct unrolled_fold<Result,2>
{
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return f(state1,fusion::deref(it1));
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,fusion::deref(it0));
- return f(
- state1,
- fusion::deref( fusion::next(it0)));
+ return call_1(
+ f(state,fusion::deref(it0)),
+ fusion::next(it0),
+ f);
}
};
template<typename Result>
struct unrolled_fold<Result,1>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
@@ -119,7 +135,7 @@ namespace boost { namespace fusion
struct unrolled_fold<Result,0>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
@@ -257,7 +273,7 @@ namespace boost { namespace fusion
{
typedef typename
result_of_unrolled_fold<
- typename boost::result_of<
+ typename fusion::detail::result_of_with_decltype<
F(
StateRef,
typename fusion::result_of::deref< It0 const>::type
@@ -282,7 +298,7 @@ namespace boost { namespace fusion
, SeqSize
>::type
type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
@@ -302,7 +318,7 @@ namespace boost { namespace fusion
struct fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
@@ -334,7 +350,7 @@ namespace boost { namespace fusion
{};
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold<
Seq
, State const
@@ -348,7 +364,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold<
Seq const
, State const
@@ -362,7 +378,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold<
Seq
, State const
@@ -376,7 +392,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold<
Seq const
, State const
diff --git a/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp b/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp
index 1211550d39..1d294a8722 100644
--- a/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp
+++ b/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp
@@ -13,7 +13,7 @@ namespace boost { namespace fusion
{
template<typename State, typename It, typename F>
struct iter_fold_lvalue_state
- : boost::result_of<
+ : fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
It&)
@@ -22,35 +22,11 @@ namespace boost { namespace fusion
template<typename Result,int N>
struct unrolled_iter_fold
{
- template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ template<typename State3, typename It3, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
- call(State const& state,It0 const& it0,F f)
+ call_3(State3 const& state3,It3 const& it3,F& f)
{
- typedef typename
- result_of::next<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::next(it0);
- typedef typename
- result_of::next<
- It1
- >::type
- It2;
- It2 it2 = fusion::next(it1);
- typedef typename
- result_of::next<
- It2
- >::type
- It3;
- It3 it3 = fusion::next(it2);
- typedef typename iter_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,it0);
- typedef typename iter_fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,it1);
- typedef typename iter_fold_lvalue_state<State2,It2,F>::type State3;
- State3 const state3=f(state2,it2);
return unrolled_iter_fold<
Result
, N-4
@@ -59,54 +35,94 @@ namespace boost { namespace fusion
fusion::next(it3),
f);
}
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return call_3(
+ f(state2,it2),
+ fusion::next(it2),
+ f);
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,it1),
+ fusion::next(it1),
+ f);
+ }
+ template<typename State, typename It0, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call(State const& state,It0 const& it0,F f)
+ {
+ return call_1(
+ f(state,it0),
+ fusion::next(it0),
+ f);
+ }
};
template<typename Result>
struct unrolled_iter_fold<Result,3>
{
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return f(state2,it2);
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,it1),
+ fusion::next(it1),
+ f);
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename
- result_of::next<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::next(it0);
- typedef typename
- result_of::next<
- It1
- >::type
- It2;
- It2 it2 = fusion::next(it1);
- typedef typename iter_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,it0);
- typedef typename iter_fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,it1);
- return f(state2,it2);
+ return call_1(
+ f(state,it0),
+ fusion::next(it0),
+ f);
}
};
template<typename Result>
struct unrolled_iter_fold<Result,2>
{
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return f(state1,it1);
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename iter_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,it0);
- return f(
- state1,
- fusion::next(it0));
+ return call_1(
+ f(state,it0),
+ fusion::next(it0),
+ f);
}
};
template<typename Result>
struct unrolled_iter_fold<Result,1>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
@@ -118,7 +134,7 @@ namespace boost { namespace fusion
struct unrolled_iter_fold<Result,0>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
@@ -256,7 +272,7 @@ namespace boost { namespace fusion
{
typedef typename
result_of_unrolled_iter_fold<
- typename boost::result_of<
+ typename fusion::detail::result_of_with_decltype<
F(
StateRef,
It0 const&
@@ -281,7 +297,7 @@ namespace boost { namespace fusion
, SeqSize
>::type
type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
@@ -301,7 +317,7 @@ namespace boost { namespace fusion
struct iter_fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
@@ -333,7 +349,7 @@ namespace boost { namespace fusion
{};
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold<
Seq
, State const
@@ -347,7 +363,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold<
Seq const
, State const
@@ -361,7 +377,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold<
Seq
, State const
@@ -375,7 +391,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold<
Seq const
, State const
diff --git a/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp b/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
index cc78231a50..947897821a 100644
--- a/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
+++ b/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
@@ -13,7 +13,7 @@ namespace boost { namespace fusion
{
template<typename State, typename It, typename F>
struct reverse_fold_lvalue_state
- : boost::result_of<
+ : fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
typename fusion::result_of::deref<It>::type)
@@ -22,35 +22,11 @@ namespace boost { namespace fusion
template<typename Result,int N>
struct unrolled_reverse_fold
{
- template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ template<typename State3, typename It3, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
- call(State const& state,It0 const& it0,F f)
+ call_3(State3 const& state3,It3 const& it3,F& f)
{
- typedef typename
- result_of::prior<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::prior(it0);
- typedef typename
- result_of::prior<
- It1
- >::type
- It2;
- It2 it2 = fusion::prior(it1);
- typedef typename
- result_of::prior<
- It2
- >::type
- It3;
- It3 it3 = fusion::prior(it2);
- typedef typename reverse_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,fusion::deref(it0));
- typedef typename reverse_fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,fusion::deref(it1));
- typedef typename reverse_fold_lvalue_state<State2,It2,F>::type State3;
- State3 const state3=f(state2,fusion::deref(it2));
return unrolled_reverse_fold<
Result
, N-4
@@ -59,54 +35,94 @@ namespace boost { namespace fusion
fusion::prior(it3),
f);
}
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return call_3(
+ f(state2,fusion::deref(it2)),
+ fusion::prior(it2),
+ f);
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,fusion::deref(it1)),
+ fusion::prior(it1),
+ f);
+ }
+ template<typename State, typename It0, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call(State const& state,It0 const& it0,F f)
+ {
+ return call_1(
+ f(state,fusion::deref(it0)),
+ fusion::prior(it0),
+ f);
+ }
};
template<typename Result>
struct unrolled_reverse_fold<Result,3>
{
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return f(state2,fusion::deref(it2));
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,fusion::deref(it1)),
+ fusion::prior(it1),
+ f);
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename
- result_of::prior<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::prior(it0);
- typedef typename
- result_of::prior<
- It1
- >::type
- It2;
- It2 it2 = fusion::prior(it1);
- typedef typename reverse_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,fusion::deref(it0));
- typedef typename reverse_fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,fusion::deref(it1));
- return f(state2,fusion::deref(it2));
+ return call_1(
+ f(state,fusion::deref(it0)),
+ fusion::prior(it0),
+ f);
}
};
template<typename Result>
struct unrolled_reverse_fold<Result,2>
{
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return f(state1,fusion::deref(it1));
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename reverse_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,fusion::deref(it0));
- return f(
- state1,
- fusion::deref( fusion::prior(it0)));
+ return call_1(
+ f(state,fusion::deref(it0)),
+ fusion::prior(it0),
+ f);
}
};
template<typename Result>
struct unrolled_reverse_fold<Result,1>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
@@ -118,7 +134,7 @@ namespace boost { namespace fusion
struct unrolled_reverse_fold<Result,0>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
@@ -256,7 +272,7 @@ namespace boost { namespace fusion
{
typedef typename
result_of_unrolled_reverse_fold<
- typename boost::result_of<
+ typename fusion::detail::result_of_with_decltype<
F(
StateRef,
typename fusion::result_of::deref< It0 const>::type
@@ -281,7 +297,7 @@ namespace boost { namespace fusion
, SeqSize
>::type
type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
@@ -301,7 +317,7 @@ namespace boost { namespace fusion
struct reverse_fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
@@ -333,7 +349,7 @@ namespace boost { namespace fusion
{};
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold<
Seq
, State const
@@ -347,7 +363,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold<
Seq const
, State const
@@ -361,7 +377,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold<
Seq
, State const
@@ -375,7 +391,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold<
Seq const
, State const
diff --git a/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp b/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp
index 3023a91239..bf1edca53d 100644
--- a/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp
+++ b/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp
@@ -13,7 +13,7 @@ namespace boost { namespace fusion
{
template<typename State, typename It, typename F>
struct reverse_iter_fold_lvalue_state
- : boost::result_of<
+ : fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
It&)
@@ -22,35 +22,11 @@ namespace boost { namespace fusion
template<typename Result,int N>
struct unrolled_reverse_iter_fold
{
- template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ template<typename State3, typename It3, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
- call(State const& state,It0 const& it0,F f)
+ call_3(State3 const& state3,It3 const& it3,F& f)
{
- typedef typename
- result_of::prior<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::prior(it0);
- typedef typename
- result_of::prior<
- It1
- >::type
- It2;
- It2 it2 = fusion::prior(it1);
- typedef typename
- result_of::prior<
- It2
- >::type
- It3;
- It3 it3 = fusion::prior(it2);
- typedef typename reverse_iter_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,it0);
- typedef typename reverse_iter_fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,it1);
- typedef typename reverse_iter_fold_lvalue_state<State2,It2,F>::type State3;
- State3 const state3=f(state2,it2);
return unrolled_reverse_iter_fold<
Result
, N-4
@@ -59,54 +35,94 @@ namespace boost { namespace fusion
fusion::prior(it3),
f);
}
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return call_3(
+ f(state2,it2),
+ fusion::prior(it2),
+ f);
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,it1),
+ fusion::prior(it1),
+ f);
+ }
+ template<typename State, typename It0, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call(State const& state,It0 const& it0,F f)
+ {
+ return call_1(
+ f(state,it0),
+ fusion::prior(it0),
+ f);
+ }
};
template<typename Result>
struct unrolled_reverse_iter_fold<Result,3>
{
+ template<typename State2, typename It2, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_2(State2 const& state2,It2 const& it2,F& f)
+ {
+ return f(state2,it2);
+ }
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return call_2(
+ f(state1,it1),
+ fusion::prior(it1),
+ f);
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename
- result_of::prior<
- It0 const
- >::type
- It1;
- It1 it1 = fusion::prior(it0);
- typedef typename
- result_of::prior<
- It1
- >::type
- It2;
- It2 it2 = fusion::prior(it1);
- typedef typename reverse_iter_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,it0);
- typedef typename reverse_iter_fold_lvalue_state<State1,It1,F>::type State2;
- State2 const state2=f(state1,it1);
- return f(state2,it2);
+ return call_1(
+ f(state,it0),
+ fusion::prior(it0),
+ f);
}
};
template<typename Result>
struct unrolled_reverse_iter_fold<Result,2>
{
+ template<typename State1, typename It1, typename F>
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ static Result
+ call_1(State1 const& state1,It1 const& it1,F& f)
+ {
+ return f(state1,it1);
+ }
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
- typedef typename reverse_iter_fold_lvalue_state<State,It0,F>::type State1;
- State1 const state1=f(state,it0);
- return f(
- state1,
- fusion::prior(it0));
+ return call_1(
+ f(state,it0),
+ fusion::prior(it0),
+ f);
}
};
template<typename Result>
struct unrolled_reverse_iter_fold<Result,1>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
@@ -118,7 +134,7 @@ namespace boost { namespace fusion
struct unrolled_reverse_iter_fold<Result,0>
{
template<typename State, typename It0, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
@@ -256,7 +272,7 @@ namespace boost { namespace fusion
{
typedef typename
result_of_unrolled_reverse_iter_fold<
- typename boost::result_of<
+ typename fusion::detail::result_of_with_decltype<
F(
StateRef,
It0 const&
@@ -281,7 +297,7 @@ namespace boost { namespace fusion
, SeqSize
>::type
type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
@@ -301,7 +317,7 @@ namespace boost { namespace fusion
struct reverse_iter_fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
@@ -333,7 +349,7 @@ namespace boost { namespace fusion
{};
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold<
Seq
, State const
@@ -347,7 +363,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold<
Seq const
, State const
@@ -361,7 +377,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold<
Seq
, State const
@@ -375,7 +391,7 @@ namespace boost { namespace fusion
f);
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold<
Seq const
, State const
diff --git a/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp b/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp
index 58aab114a2..4ff679af2e 100644
--- a/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp
+++ b/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp
@@ -16,7 +16,7 @@ namespace boost { namespace fusion { namespace detail
template <typename Fun>
struct segmented_fold_fun
{
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit segmented_fold_fun(Fun const& f)
: fun(f)
{}
@@ -29,7 +29,7 @@ namespace boost { namespace fusion { namespace detail
typedef typename result_of::fold<Sequence, State, Fun>::type type;
typedef mpl::true_ continue_type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq, State const& state, Context const&, segmented_fold_fun const& fun)
{
return fusion::fold(seq, state, fun.fun);
@@ -52,7 +52,7 @@ namespace boost { namespace fusion { namespace detail
>::type
type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(State& state, Sequence& seq, Fun fun)
{
return fusion::segmented_fold_until(seq, state, segmented_fold_fun<Fun>(fun));
diff --git a/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp b/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp
index a5d6d4be3e..a32d9dad00 100644
--- a/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp
+++ b/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp
@@ -18,7 +18,7 @@ namespace boost { namespace fusion { namespace detail
template <typename Fun>
struct segmented_for_each_fun
{
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit segmented_for_each_fun(Fun const& f)
: fun(f)
{}
@@ -31,7 +31,7 @@ namespace boost { namespace fusion { namespace detail
typedef void_ type;
typedef mpl::true_ continue_type;
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq, State const&, Context const&, segmented_for_each_fun const& fun)
{
fusion::for_each(seq, fun.fun);
@@ -41,7 +41,7 @@ namespace boost { namespace fusion { namespace detail
};
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline void
for_each(Sequence& seq, F const& f, mpl::true_) // segmented implementation
{
diff --git a/boost/fusion/algorithm/iteration/fold.hpp b/boost/fusion/algorithm/iteration/fold.hpp
index a83b33b15a..a2a0146ab4 100644
--- a/boost/fusion/algorithm/iteration/fold.hpp
+++ b/boost/fusion/algorithm/iteration/fold.hpp
@@ -10,6 +10,7 @@
#define BOOST_FUSION_ALGORITHM_ITERATION_FOLD_HPP
#include <boost/fusion/support/config.hpp>
+#include <boost/fusion/support/detail/result_of.hpp>
#include <boost/fusion/algorithm/iteration/fold_fwd.hpp>
#include <boost/config.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
diff --git a/boost/fusion/algorithm/iteration/fold_fwd.hpp b/boost/fusion/algorithm/iteration/fold_fwd.hpp
index cd8dcd81c6..f8328e80f9 100644
--- a/boost/fusion/algorithm/iteration/fold_fwd.hpp
+++ b/boost/fusion/algorithm/iteration/fold_fwd.hpp
@@ -17,8 +17,8 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::fold<
Seq
, State const
, F
@@ -26,8 +26,8 @@ namespace boost { namespace fusion
fold(Seq& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::fold<
Seq const
, State const
, F
@@ -35,8 +35,8 @@ namespace boost { namespace fusion
fold(Seq const& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::fold<
Seq
, State const
, F
@@ -44,8 +44,8 @@ namespace boost { namespace fusion
fold(Seq& seq, State& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::fold<
Seq const
, State const
, F
diff --git a/boost/fusion/algorithm/iteration/for_each.hpp b/boost/fusion/algorithm/iteration/for_each.hpp
index 836f4810a6..a523c85eb0 100644
--- a/boost/fusion/algorithm/iteration/for_each.hpp
+++ b/boost/fusion/algorithm/iteration/for_each.hpp
@@ -27,9 +27,8 @@ namespace boost { namespace fusion
}
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
- inline
- typename
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
enable_if<
traits::is_sequence<Sequence>
, void
@@ -40,9 +39,8 @@ namespace boost { namespace fusion
}
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
- inline
- typename
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
enable_if<
traits::is_sequence<Sequence>
, void
diff --git a/boost/fusion/algorithm/iteration/for_each_fwd.hpp b/boost/fusion/algorithm/iteration/for_each_fwd.hpp
index 44a3d1da24..13720eadae 100644
--- a/boost/fusion/algorithm/iteration/for_each_fwd.hpp
+++ b/boost/fusion/algorithm/iteration/for_each_fwd.hpp
@@ -20,9 +20,8 @@ namespace boost { namespace fusion
}
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
- inline
- typename
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
enable_if<
traits::is_sequence<Sequence>
, void
@@ -30,9 +29,8 @@ namespace boost { namespace fusion
for_each(Sequence& seq, F const& f);
template <typename Sequence, typename F>
- BOOST_FUSION_GPU_ENABLED
- inline
- typename
+ BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename
enable_if<
traits::is_sequence<Sequence>
, void
diff --git a/boost/fusion/algorithm/iteration/iter_fold.hpp b/boost/fusion/algorithm/iteration/iter_fold.hpp
index 4c03cdf80f..b59a6957bc 100644
--- a/boost/fusion/algorithm/iteration/iter_fold.hpp
+++ b/boost/fusion/algorithm/iteration/iter_fold.hpp
@@ -17,6 +17,7 @@
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/is_segmented.hpp>
+#include <boost/fusion/support/detail/result_of.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp>
@@ -25,7 +26,6 @@
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
-#include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
diff --git a/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp b/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp
index 8e4898ba0b..6c595cf198 100644
--- a/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp
+++ b/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp
@@ -17,8 +17,8 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::iter_fold<
Seq
, State const
, F
@@ -26,8 +26,8 @@ namespace boost { namespace fusion
iter_fold(Seq& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::iter_fold<
Seq const
, State const
, F
@@ -35,8 +35,8 @@ namespace boost { namespace fusion
iter_fold(Seq const& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::iter_fold<
Seq
, State const
, F
@@ -44,8 +44,8 @@ namespace boost { namespace fusion
iter_fold(Seq& seq, State& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::iter_fold<
Seq const
, State const
, F
diff --git a/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp b/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp
index c5596e79ef..42c8ac2163 100644
--- a/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp
+++ b/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp
@@ -17,8 +17,8 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_fold<
Seq
, State const
, F
@@ -26,8 +26,8 @@ namespace boost { namespace fusion
reverse_fold(Seq& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_fold<
Seq const
, State const
, F
@@ -35,8 +35,8 @@ namespace boost { namespace fusion
reverse_fold(Seq const& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_fold<
Seq
, State const
, F
@@ -44,8 +44,8 @@ namespace boost { namespace fusion
reverse_fold(Seq& seq, State& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_fold<
Seq const
, State const
, F
diff --git a/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp b/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp
index 7b49ea69c2..21d99deead 100644
--- a/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp
+++ b/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp
@@ -17,8 +17,8 @@ namespace boost { namespace fusion
}
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_iter_fold<
Seq
, State const
, F
@@ -26,8 +26,8 @@ namespace boost { namespace fusion
reverse_iter_fold(Seq& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_iter_fold<
Seq const
, State const
, F
@@ -35,8 +35,8 @@ namespace boost { namespace fusion
reverse_iter_fold(Seq const& seq, State const& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_iter_fold<
Seq
, State const
, F
@@ -44,8 +44,8 @@ namespace boost { namespace fusion
reverse_iter_fold(Seq& seq, State& state, F f);
template<typename Seq, typename State, typename F>
- BOOST_FUSION_GPU_ENABLED
- typename result_of::reverse_iter_fold<
+ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
+ inline typename result_of::reverse_iter_fold<
Seq const
, State const
, F