diff --git a/include/boost/fusion/functional/adapter/unfused_typed.hpp b/include/boost/fusion/functional/adapter/unfused_typed.hpp index 1858cc45..94385a35 100644 --- a/include/boost/fusion/functional/adapter/unfused_typed.hpp +++ b/include/boost/fusion/functional/adapter/unfused_typed.hpp @@ -13,9 +13,9 @@ #include #include #include +#include #include -#include #include @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -39,7 +38,7 @@ namespace boost { namespace fusion namespace detail { - template struct unfused_typed_impl; } @@ -47,71 +46,25 @@ namespace boost { namespace fusion template class unfused_typed : public detail::unfused_typed_impl - < unfused_typed, typename detail::qf_c::type, - typename detail::qf::type, Sequence, result_of::size::value > + < unfused_typed, Function, Sequence, + result_of::size::value > { Function fnc_transformed; - typedef typename detail::qf_c::type function_c; - typedef typename detail::qf::type function; + template + friend struct detail::unfused_typed_impl; typedef typename detail::call_param::type func_const_fwd_t; - typedef typename detail::unfused_typed_impl< - unfused_typed,function_c,function,Sequence, - result_of::size::value > base; - - template - friend struct detail::unfused_typed_impl; - public: inline explicit unfused_typed(func_const_fwd_t f = Function()) : fnc_transformed(f) { } - - template - struct result; }; - namespace detail - { - template - struct unfused_typed_impl - { - typedef fusion::vector0 arg_vector_t; - - public: - - typedef typename boost::result_of< - FunctionC (arg_vector_t &) > call_const_0_result; - - typedef typename boost::result_of< - Function(arg_vector_t &) > call_0_result; - - inline typename boost::result_of< - FunctionC (arg_vector_t &) >::type - operator()() const - { - arg_vector_t arg; - return static_cast(this)->fnc_transformed(arg); - } - -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) - inline typename boost::result_of< - Function (arg_vector_t &) >::type - operator()() - { - arg_vector_t arg; - return static_cast(this)->fnc_transformed(arg); - } -#endif - }; - } - #define BOOST_PP_FILENAME_1 - #define BOOST_PP_ITERATION_LIMITS (1,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY) + #define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY) #include BOOST_PP_ITERATE() }} @@ -120,11 +73,13 @@ namespace boost { template struct result_of< boost::fusion::unfused_typed const () > - : boost::fusion::unfused_typed::call_const_0_result + : boost::fusion::unfused_typed::template result< + boost::fusion::unfused_typed const () > { }; template struct result_of< boost::fusion::unfused_typed() > - : boost::fusion::unfused_typed::call_0_result + : boost::fusion::unfused_typed::template result< + boost::fusion::unfused_typed () > { }; } @@ -141,72 +96,59 @@ namespace boost namespace detail { - template - struct unfused_typed_impl - : unfused_typed_impl::type, BOOST_PP_DEC(N) > + template + struct unfused_typed_impl { + typedef typename detail::qf_c::type function_c; + typedef typename detail::qf::type function; typedef typename result_of::as_vector::type arg_vector_t; - protected: - - typedef typename boost::result_of< - FunctionC(arg_vector_t &) > BOOST_PP_CAT(rc,N); - - typedef typename boost::result_of< - Function(arg_vector_t &) > BOOST_PP_CAT(r,N); - public: - using unfused_typed_impl< Derived,FunctionC,Function, - typename result_of::pop_back::type, BOOST_PP_DEC(N) - >::operator(); - #define M(z,i,s) \ typename call_param::type>::type a##i inline typename boost::result_of< - FunctionC(arg_vector_t &) >::type + function_c(arg_vector_t &) >::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const { +#if N > 0 arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a)); +#else + arg_vector_t arg; +#endif return static_cast(this)->fnc_transformed(arg); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) inline typename boost::result_of< - Function(arg_vector_t &) >::type + function(arg_vector_t &) >::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) { +#if N > 0 arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a)); +#else + arg_vector_t arg; +#endif return static_cast(this)->fnc_transformed(arg); } -#endif #undef M + + template struct result { typedef void type; }; + + template + struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) > + : boost::result_of< function_c(arg_vector_t &) > + { }; + + template + struct result< Self (BOOST_PP_ENUM_PARAMS(N,T)) > + : boost::result_of< function(arg_vector_t &) > + { }; }; } // namespace detail -#if N > 0 - template - template - struct unfused_typed::result< - Self const (BOOST_PP_ENUM_PARAMS(N,T)) > - : BOOST_PP_CAT(base::rc,N) - { }; - -# if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) - template - template - struct unfused_typed::result< - Self (BOOST_PP_ENUM_PARAMS(N,T)) > - : BOOST_PP_CAT(base::r,N) - { }; -# endif -#endif - #undef N #endif // defined(BOOST_PP_IS_ITERATING) #endif