diff options
Diffstat (limited to 'boost/fusion/functional')
10 files changed, 146 insertions, 125 deletions
diff --git a/boost/fusion/functional/adapter/fused.hpp b/boost/fusion/functional/adapter/fused.hpp index c6b1b03c81..c27d0acc5c 100644 --- a/boost/fusion/functional/adapter/fused.hpp +++ b/boost/fusion/functional/adapter/fused.hpp @@ -37,13 +37,13 @@ namespace boost { namespace fusion public: - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline explicit fused(func_const_fwd_t f = Function()) : fnc_transformed(f) { } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke<func_const_fwd_t,Seq const>::type operator()(Seq const & s) const { @@ -51,7 +51,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke<func_fwd_t,Seq const>::type operator()(Seq const & s) { @@ -59,7 +59,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke<func_const_fwd_t,Seq>::type operator()(Seq & s) const { @@ -67,7 +67,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke<func_fwd_t,Seq>::type operator()(Seq & s) { diff --git a/boost/fusion/functional/adapter/fused_function_object.hpp b/boost/fusion/functional/adapter/fused_function_object.hpp index b3973a11d1..cdb9c24bd4 100644 --- a/boost/fusion/functional/adapter/fused_function_object.hpp +++ b/boost/fusion/functional/adapter/fused_function_object.hpp @@ -37,13 +37,13 @@ namespace boost { namespace fusion public: - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline explicit fused_function_object(func_const_fwd_t f = Function()) : fnc_transformed(f) { } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke_function_object<func_const_fwd_t, Seq const>::type operator()(Seq const & s) const { @@ -52,7 +52,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke_function_object<func_fwd_t, Seq const>::type operator()(Seq const & s) @@ -62,7 +62,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke_function_object<func_const_fwd_t, Seq>::type operator()(Seq & s) const @@ -72,7 +72,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke_function_object<func_fwd_t,Seq>::type operator()(Seq & s) { diff --git a/boost/fusion/functional/adapter/fused_procedure.hpp b/boost/fusion/functional/adapter/fused_procedure.hpp index 495320af7b..79be217672 100644 --- a/boost/fusion/functional/adapter/fused_procedure.hpp +++ b/boost/fusion/functional/adapter/fused_procedure.hpp @@ -37,13 +37,13 @@ namespace boost { namespace fusion public: - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline explicit fused_procedure(func_const_fwd_t f = Function()) : fnc_transformed(f) { } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline void operator()(Seq const & s) const { fusion::invoke_procedure< @@ -51,7 +51,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline void operator()(Seq const & s) { fusion::invoke_procedure< @@ -59,7 +59,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline void operator()(Seq & s) const { fusion::invoke_procedure< @@ -67,7 +67,7 @@ namespace boost { namespace fusion } template <class Seq> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline void operator()(Seq & s) { return fusion::invoke_procedure< diff --git a/boost/fusion/functional/adapter/unfused.hpp b/boost/fusion/functional/adapter/unfused.hpp index b02f5d28a9..9d85869dcf 100644 --- a/boost/fusion/functional/adapter/unfused.hpp +++ b/boost/fusion/functional/adapter/unfused.hpp @@ -47,14 +47,16 @@ namespace boost { namespace fusion using unfused<Function,false>::operator(); - BOOST_FUSION_GPU_ENABLED inline explicit unfused(func_const_fwd_t f = function()) + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline explicit unfused(func_const_fwd_t f = function()) : unfused<Function,false>(f) { } typedef typename boost::result_of< function_c(fusion::vector0<> &) >::type call_const_0_result; - BOOST_FUSION_GPU_ENABLED inline call_const_0_result operator()() const + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline call_const_0_result operator()() const { fusion::vector0<> arg; return this->fnc_transformed(arg); @@ -63,7 +65,8 @@ namespace boost { namespace fusion typedef typename boost::result_of< function(fusion::vector0<> &) >::type call_0_result; - BOOST_FUSION_GPU_ENABLED inline call_0_result operator()() + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline call_0_result operator()() { fusion::vector0<> arg; return this->fnc_transformed(arg); @@ -79,7 +82,7 @@ namespace boost { namespace fusion typedef typename detail::call_param<Function>::type func_const_fwd_t; public: - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline explicit unfused(func_const_fwd_t f = function()) : fnc_transformed(f) { } @@ -149,7 +152,7 @@ namespace boost { }; template <BOOST_PP_ENUM_PARAMS(N,typename T)> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename boost::result_of<function_c(BOOST_PP_CAT(fusion::vector,N) <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const @@ -161,7 +164,7 @@ namespace boost } template <BOOST_PP_ENUM_PARAMS(N,typename T)> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N) <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) diff --git a/boost/fusion/functional/adapter/unfused_typed.hpp b/boost/fusion/functional/adapter/unfused_typed.hpp index c3ab33dd74..23faf15313 100644 --- a/boost/fusion/functional/adapter/unfused_typed.hpp +++ b/boost/fusion/functional/adapter/unfused_typed.hpp @@ -63,7 +63,7 @@ namespace boost { namespace fusion public: - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline explicit unfused_typed(func_const_fwd_t f = Function()) : fnc_transformed(f) { } @@ -130,7 +130,7 @@ namespace boost #define M(z,i,s) \ typename call_param<typename result_of::value_at_c<s,i>::type>::type a##i - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename boost::result_of< function_c(arg_vector_t &) >::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const @@ -143,7 +143,7 @@ namespace boost return static_cast<Derived const *>(this)->fnc_transformed(arg); } - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename boost::result_of< function(arg_vector_t &) >::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) diff --git a/boost/fusion/functional/generation/detail/gen_make_adapter.hpp b/boost/fusion/functional/generation/detail/gen_make_adapter.hpp index b7744826bd..2548a08654 100644 --- a/boost/fusion/functional/generation/detail/gen_make_adapter.hpp +++ b/boost/fusion/functional/generation/detail/gen_make_adapter.hpp @@ -31,7 +31,7 @@ namespace boost { namespace fusion } template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FUNC_NAME<F>::type BOOST_FUSION_FUNC_NAME(F const & f) { diff --git a/boost/fusion/functional/invocation/detail/that_ptr.hpp b/boost/fusion/functional/invocation/detail/that_ptr.hpp index a2b4a86a4d..7a1a5c5700 100644 --- a/boost/fusion/functional/invocation/detail/that_ptr.hpp +++ b/boost/fusion/functional/invocation/detail/that_ptr.hpp @@ -25,13 +25,13 @@ namespace boost { namespace fusion { namespace detail typedef typename remove_reference<Wanted>::type pointee; template <typename T> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline pointee * do_get_pointer(T &, pointee * x) { return x; } template <typename T> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline pointee * do_get_pointer(T & x, void const *) { return get_pointer(x); @@ -39,20 +39,20 @@ namespace boost { namespace fusion { namespace detail public: - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline pointee * get(pointee * x) { return x; } - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline pointee * get(pointee & x) { return boost::addressof(x); } template <typename T> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline pointee * get(T & x) { return do_get_pointer(x, boost::addressof(x)); diff --git a/boost/fusion/functional/invocation/invoke.hpp b/boost/fusion/functional/invocation/invoke.hpp index d4aa945647..b79ff5b439 100644 --- a/boost/fusion/functional/invocation/invoke.hpp +++ b/boost/fusion/functional/invocation/invoke.hpp @@ -41,6 +41,7 @@ #include <boost/utility/result_of.hpp> #include <boost/fusion/support/category_of.hpp> +#include <boost/fusion/support/detail/enabler.hpp> #include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/front.hpp> @@ -52,21 +53,6 @@ namespace boost { namespace fusion { - namespace result_of - { - template <typename Function, class Sequence> struct invoke; - } - - //~ template <typename Function, class Sequence> - //~ inline typename result_of::invoke<Function, Sequence>::type - //~ invoke(Function, Sequence &); - - //~ template <typename Function, class Sequence> - //~ inline typename result_of::invoke<Function, Sequence const>::type - //~ invoke(Function, Sequence const &); - - //----- ---- --- -- - - - - - namespace detail { namespace ft = function_types; @@ -75,7 +61,8 @@ namespace boost { namespace fusion typename Function, class Sequence, int N = result_of::size<Sequence>::value, bool CBI = ft::is_callable_builtin<Function>::value, - bool RandomAccess = traits::is_random_access<Sequence>::value + bool RandomAccess = traits::is_random_access<Sequence>::value, + typename Enable = void > struct invoke_impl; @@ -104,16 +91,16 @@ namespace boost { namespace fusion Sequence, N, RandomAccess > { }; - template <typename Function, class Sequence, int N, bool RandomAccess> - struct invoke_impl<Function,Sequence,N,true,RandomAccess> + template <typename Function, class Sequence, int N, bool RandomAccess, typename Enable> + struct invoke_impl<Function,Sequence,N,true,RandomAccess,Enable> : mpl::if_< ft::is_member_function_pointer<Function>, invoke_mem_fn<Function,Sequence,N,RandomAccess>, invoke_nonmember_builtin<Function,Sequence,N,RandomAccess> >::type { }; - template <typename Function, class Sequence, bool RandomAccess> - struct invoke_impl<Function,Sequence,1,true,RandomAccess> + template <typename Function, class Sequence, bool RandomAccess, typename Enable> + struct invoke_impl<Function,Sequence,1,true,RandomAccess,Enable> : mpl::eval_if< ft::is_member_pointer<Function>, mpl::if_< ft::is_member_function_pointer<Function>, invoke_mem_fn<Function,Sequence,1,RandomAccess>, @@ -145,7 +132,7 @@ namespace boost { namespace fusion typedef typename boost::add_reference<qualified_type>::type result_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(T C::* f, Sequence & s) { typename result_of::front<Sequence>::type c = fusion::front(s); @@ -156,16 +143,25 @@ namespace boost { namespace fusion namespace result_of { - template <typename Function, class Sequence> struct invoke + template <typename Function, class Sequence, typename = void> + struct invoke; + + template <typename Function, class Sequence> + struct invoke<Function, Sequence, + typename detail::enabler< + typename detail::invoke_impl< + typename boost::remove_reference<Function>::type, Sequence + >::result_type + >::type> { typedef typename detail::invoke_impl< typename boost::remove_reference<Function>::type, Sequence - >::result_type type; + >::result_type type; }; } template <typename Function, class Sequence> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke<Function,Sequence>::type invoke(Function f, Sequence & s) { @@ -175,7 +171,7 @@ namespace boost { namespace fusion } template <typename Function, class Sequence> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke<Function,Sequence const>::type invoke(Function f, Sequence const & s) { @@ -195,20 +191,24 @@ namespace boost { namespace fusion /////////////////////////////////////////////////////////////////////////////// #define N BOOST_PP_ITERATION() +#define M(z,j,data) typename result_of::at_c<Sequence,j>::type + template <typename Function, class Sequence> - struct invoke_impl<Function,Sequence,N,false,true> + struct invoke_impl<Function,Sequence,N,false,true, + typename enabler< + typename boost::result_of<Function(BOOST_PP_ENUM(N,M,~)) >::type + >::type> { public: typedef typename boost::result_of< -#define M(z,j,data) typename result_of::at_c<Sequence,j>::type Function(BOOST_PP_ENUM(N,M,~)) >::type result_type; #undef M #if N > 0 template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -218,7 +218,7 @@ namespace boost { namespace fusion #else template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & /*s*/) { @@ -239,7 +239,7 @@ namespace boost { namespace fusion #if N > 0 template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -249,7 +249,7 @@ namespace boost { namespace fusion #else template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & /*s*/) { @@ -270,7 +270,7 @@ namespace boost { namespace fusion typedef typename ft::result_type<Function>::type result_type; template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -288,7 +288,12 @@ namespace boost { namespace fusion fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(j))); template <typename Function, class Sequence> - struct invoke_impl<Function,Sequence,N,false,false> + struct invoke_impl<Function,Sequence,N,false,false, + typename enabler< +#define L(z,j,data) typename invoke_param_types<Sequence,N>::BOOST_PP_CAT(T, j) + typename boost::result_of<Function(BOOST_PP_ENUM(N,L,~))>::type + >::type> +#undef L { private: typedef invoke_param_types<Sequence,N> seq; @@ -301,7 +306,7 @@ namespace boost { namespace fusion #if N > 0 template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -313,7 +318,7 @@ namespace boost { namespace fusion #else template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & /*s*/) { @@ -336,7 +341,7 @@ namespace boost { namespace fusion #if N > 0 template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -348,7 +353,7 @@ namespace boost { namespace fusion #else template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & /*s*/) { @@ -370,7 +375,7 @@ namespace boost { namespace fusion typedef typename ft::result_type<Function>::type result_type; template <typename F> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { diff --git a/boost/fusion/functional/invocation/invoke_function_object.hpp b/boost/fusion/functional/invocation/invoke_function_object.hpp index a5c9510c25..3ed508dd3d 100644 --- a/boost/fusion/functional/invocation/invoke_function_object.hpp +++ b/boost/fusion/functional/invocation/invoke_function_object.hpp @@ -25,6 +25,7 @@ #include <boost/utility/result_of.hpp> #include <boost/fusion/support/category_of.hpp> +#include <boost/fusion/support/detail/enabler.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp> @@ -34,29 +35,13 @@ namespace boost { namespace fusion { - namespace result_of - { - template <class Function, class Sequence> struct invoke_function_object; - } - - template <class Function, class Sequence> - BOOST_FUSION_GPU_ENABLED - inline typename result_of::invoke_function_object<Function, Sequence>::type - invoke_function_object(Function, Sequence &); - - template <class Function, class Sequence> - BOOST_FUSION_GPU_ENABLED - inline typename result_of::invoke_function_object<Function, Sequence const - >::type invoke_function_object(Function, Sequence const &); - - //----- ---- --- -- - - - - - namespace detail { template< class Function, class Sequence, int N = result_of::size<Sequence>::value, - bool RandomAccess = traits::is_random_access<Sequence>::value + bool RandomAccess = traits::is_random_access<Sequence>::value, + typename Enable = void > struct invoke_function_object_impl; @@ -72,7 +57,16 @@ namespace boost { namespace fusion namespace result_of { - template <class Function, class Sequence> struct invoke_function_object + template <class Function, class Sequence, class Enable = void> + struct invoke_function_object; + + template <class Function, class Sequence> + struct invoke_function_object<Function, Sequence, + typename detail::enabler< + typename detail::invoke_function_object_impl< + typename boost::remove_reference<Function>::type, Sequence + >::result_type + >::type> { typedef typename detail::invoke_function_object_impl< typename boost::remove_reference<Function>::type, Sequence @@ -81,7 +75,7 @@ namespace boost { namespace fusion } template <class Function, class Sequence> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke_function_object<Function,Sequence>::type invoke_function_object(Function f, Sequence & s) { @@ -91,7 +85,7 @@ namespace boost { namespace fusion } template <class Function, class Sequence> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::invoke_function_object<Function,Sequence const>::type invoke_function_object(Function f, Sequence const & s) { @@ -111,21 +105,25 @@ namespace boost { namespace fusion /////////////////////////////////////////////////////////////////////////////// #define N BOOST_PP_ITERATION() +#define M(z,j,data) \ + typename result_of::at_c<Sequence,j>::type + template <class Function, class Sequence> - struct invoke_function_object_impl<Function,Sequence,N,true> + struct invoke_function_object_impl<Function,Sequence,N,true, + typename enabler< + typename boost::result_of<Function (BOOST_PP_ENUM(N,M,~)) >::type + >::type> { public: typedef typename boost::result_of< -#define M(z,j,data) \ - typename result_of::at_c<Sequence,j>::type Function (BOOST_PP_ENUM(N,M,~)) >::type result_type; #undef M #if N > 0 template <class F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -137,7 +135,7 @@ namespace boost { namespace fusion #else template <class F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & /*s*/) { @@ -148,8 +146,15 @@ namespace boost { namespace fusion }; +#define M(z,j,data) \ + typename invoke_function_object_param_types<Sequence,N>::T ## j + template <class Function, class Sequence> - struct invoke_function_object_impl<Function,Sequence,N,false> + struct invoke_function_object_impl<Function,Sequence,N,false, + typename enabler< + typename boost::result_of<Function (BOOST_PP_ENUM(N,M,~)) >::type + >::type> +#undef M { private: typedef invoke_function_object_param_types<Sequence,N> seq; @@ -161,7 +166,7 @@ namespace boost { namespace fusion #if N > 0 template <class F> - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & s) { @@ -177,7 +182,7 @@ namespace boost { namespace fusion #else template <class F> - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline result_type call(F & f, Sequence & /*s*/) { diff --git a/boost/fusion/functional/invocation/invoke_procedure.hpp b/boost/fusion/functional/invocation/invoke_procedure.hpp index bd3e49b9d0..a0fe73a6f3 100644 --- a/boost/fusion/functional/invocation/invoke_procedure.hpp +++ b/boost/fusion/functional/invocation/invoke_procedure.hpp @@ -28,6 +28,7 @@ #include <boost/function_types/parameter_types.hpp> #include <boost/fusion/support/category_of.hpp> +#include <boost/fusion/support/detail/enabler.hpp> #include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp> @@ -38,24 +39,6 @@ namespace boost { namespace fusion { - namespace result_of - { - template <typename Function, class Sequence> struct invoke_procedure - { - typedef void type; - }; - } - - template <typename Function, class Sequence> - BOOST_FUSION_GPU_ENABLED - inline void invoke_procedure(Function, Sequence &); - - template <typename Function, class Sequence> - BOOST_FUSION_GPU_ENABLED - inline void invoke_procedure(Function, Sequence const &); - - //----- ---- --- -- - - - - - namespace detail { namespace ft = function_types; @@ -76,9 +59,27 @@ namespace boost { namespace fusion } + namespace result_of + { + template <typename Function, class Sequence, class Enable = void> + struct invoke_procedure; + + template <typename Function, class Sequence> + struct invoke_procedure<Function, Sequence, + typename detail::enabler< + typename detail::invoke_procedure_impl< + typename boost::remove_reference<Function>::type,Sequence + >::result_type + >::type> + { + typedef void type; + }; + } + template <typename Function, class Sequence> - BOOST_FUSION_GPU_ENABLED - inline void invoke_procedure(Function f, Sequence & s) + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::invoke_procedure<Function, Sequence>::type + invoke_procedure(Function f, Sequence & s) { detail::invoke_procedure_impl< typename boost::remove_reference<Function>::type,Sequence @@ -86,8 +87,9 @@ namespace boost { namespace fusion } template <typename Function, class Sequence> - BOOST_FUSION_GPU_ENABLED - inline void invoke_procedure(Function f, Sequence const & s) + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::invoke_procedure<Function, Sequence const>::type + invoke_procedure(Function f, Sequence const & s) { detail::invoke_procedure_impl< typename boost::remove_reference<Function>::type,Sequence const @@ -110,10 +112,11 @@ namespace boost { namespace fusion template <typename Function, class Sequence> struct invoke_procedure_impl<Function,Sequence,N,false,true> { + typedef void result_type; #if N > 0 - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline void call(Function & f, Sequence & s) { f(BOOST_PP_ENUM(N,M,~)); @@ -121,7 +124,7 @@ namespace boost { namespace fusion #else - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline void call(Function & f, Sequence & /*s*/) { f(); @@ -135,7 +138,9 @@ namespace boost { namespace fusion template <typename Function, class Sequence> struct invoke_procedure_impl<Function,Sequence,N,true,true> { - BOOST_FUSION_GPU_ENABLED + typedef void result_type; + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline void call(Function & f, Sequence & s) { (that_ptr<typename mpl::front< @@ -155,10 +160,11 @@ namespace boost { namespace fusion template <typename Function, class Sequence> struct invoke_procedure_impl<Function,Sequence,N,false,false> { + typedef void result_type; #if N > 0 - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline void call(Function & f, Sequence & s) { typedef typename result_of::begin<Sequence>::type I0; @@ -168,7 +174,7 @@ namespace boost { namespace fusion } #else - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline void call(Function & f, Sequence & /*s*/) { f(); @@ -182,7 +188,9 @@ namespace boost { namespace fusion template <typename Function, class Sequence> struct invoke_procedure_impl<Function,Sequence,N,true,false> { - BOOST_FUSION_GPU_ENABLED + typedef void result_type; + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline void call(Function & f, Sequence & s) { typedef typename result_of::begin<Sequence>::type I0; |