diff --git a/include/boost/fusion/functional/adapter/detail/Attic/nullary_call_base.hpp b/include/boost/fusion/functional/adapter/detail/Attic/nullary_call_base.hpp deleted file mode 100644 index cd8383ae..00000000 --- a/include/boost/fusion/functional/adapter/detail/Attic/nullary_call_base.hpp +++ /dev/null @@ -1,127 +0,0 @@ -/*============================================================================= - Copyright (c) 2006-2007 Tobias Schwinger - - Use modification and distribution are subject to the Boost Software - License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at - http://www.boost.org/LICENSE_1_0.txt). -==============================================================================*/ - -#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_NULLARY_CALL_BASE_HPP_INCLUDED) -#define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_NULLARY_CALL_BASE_HPP_INCLUDED - -#include - -#include -#include - -#include -#include - -#include - -namespace boost { namespace fusion { namespace detail -{ - struct reserved { }; - - template - struct get_result_spec - { - private: - typedef typename boost::remove_const< - typename boost::remove_reference::type>::type function; - - typedef fusion::vector0 arg; - public: - typedef typename function::template result call_0_result; - typedef typename function::template result - call_const_0_result; - }; - - template ::call_const_0_result>::value, - bool Enable = detail::has_type< - typename get_result_spec::call_0_result>::value> - struct nullary_call_base - { - protected: - typedef typename get_result_spec::call_const_0_result - call_const_0_result_class; - - typedef typename get_result_spec::call_0_result - call_0_result_class; - public: - typedef typename call_const_0_result_class::type - call_const_0_result; - - inline call_const_0_result operator()() const - { - fusion::vector0 arg; - return static_cast(this)->fnc_transformed(arg); - } - - typedef typename get_result_spec::call_0_result::type - call_0_result; - - inline call_0_result operator()() - { - fusion::vector0 arg; - return static_cast(this)->fnc_transformed(arg); - } - }; - - template - struct nullary_call_base - { - protected: - typedef typename get_result_spec::call_const_0_result - call_const_0_result_class; - - typedef typename boost::blank call_0_result_class; - public: - typedef typename call_const_0_result_class::type - call_const_0_result, call_0_result; - - inline call_const_0_result operator()() const - { - fusion::vector0 arg; - return static_cast(this)->fnc_transformed(arg); - } - }; - - template - struct nullary_call_base - { - protected: - typedef typename boost::blank call_const_0_result_class; - - typedef typename get_result_spec::call_0_result - call_0_result_class; - public: - typedef void call_const_0_result; - typedef typename call_0_result_class::type call_0_result; - - inline call_const_0_result operator()() - { - fusion::vector0 arg; - return static_cast(this)->fnc_transformed(arg); - } - }; - - template - struct nullary_call_base - { - protected: - typedef boost::blank call_0_result_class; - typedef boost::blank call_const_0_result_class; - public: - typedef void call_0_result; - typedef void call_const_0_result; - - template inline void operator()(T reserved::*) const { } - }; - -}}} - -#endif - diff --git a/include/boost/fusion/functional/adapter/detail/access.hpp b/include/boost/fusion/functional/adapter/detail/access.hpp index 29f4ad97..7860515f 100644 --- a/include/boost/fusion/functional/adapter/detail/access.hpp +++ b/include/boost/fusion/functional/adapter/detail/access.hpp @@ -31,6 +31,11 @@ namespace boost { namespace fusion { namespace detail template struct r2fp { typedef T const type; }; template struct r2fp { typedef T type; }; + // remove_const< remove_reference<_> > + template struct uncr { typedef T type; }; + template struct uncr { typedef T type; }; + template struct uncr { typedef T type; }; + template struct uncr { typedef T type; }; }}} #endif diff --git a/include/boost/fusion/functional/adapter/unfused_generic.hpp b/include/boost/fusion/functional/adapter/unfused_generic.hpp index ec3f869e..47b37268 100644 --- a/include/boost/fusion/functional/adapter/unfused_generic.hpp +++ b/include/boost/fusion/functional/adapter/unfused_generic.hpp @@ -23,7 +23,9 @@ #include #include -#include + +#include +#include namespace boost { namespace fusion { @@ -35,16 +37,9 @@ namespace boost { namespace fusion template class unfused_generic - : public detail::nullary_call_base, Function> { Function fnc_transformed; - template - friend struct detail::nullary_call_base; - - typedef detail::nullary_call_base< - fusion::unfused_generic, Function > base; - typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; @@ -54,34 +49,39 @@ namespace boost { namespace fusion : fnc_transformed(f) { } - using base::operator(); - template - struct result - { }; + struct result; - template - struct result< Self const () > - : base::call_const_0_result_class - { }; + typedef typename boost::result_of< + function const (fusion::vector0 &) >::type call_const_0_result; - template - struct result< Self() > - : base::call_0_result_class - { }; + inline call_const_0_result operator()() const + { + fusion::vector0 arg; + return this->fnc_transformed(arg); + } + + typedef typename boost::result_of< + function (fusion::vector0 &) >::type call_0_result; + + inline call_0_result operator()() + { + fusion::vector0 arg; + return this->fnc_transformed(arg); + } #define BOOST_FUSION_CODE(tpl_params,arg_types,params,args) \ template \ - inline typename function::template result)>::type \ + inline typename boost::result_of & )>::type \ operator()(params) const \ { \ BOOST_PP_CAT(fusion::vector,N) arg(args); \ return this->fnc_transformed(arg); \ } \ template \ - inline typename function::template result)>::type \ + inline typename boost::result_of & )>::type \ operator()(params) \ { \ BOOST_PP_CAT(fusion::vector,N) arg(args); \ @@ -130,24 +130,24 @@ namespace boost template struct result < Self const (BOOST_PP_ENUM_PARAMS(N,T)) > - : function::template result::type BOOST_PP_INTERCEPT) >)> + typename detail::gref::type BOOST_PP_INTERCEPT) > & )> { }; template struct result < Self(BOOST_PP_ENUM_PARAMS(N,T)) > - : function::template result::type - BOOST_PP_INTERCEPT) >)> + : boost::result_of::type BOOST_PP_INTERCEPT) > & )> { }; #endif #if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400)) template - inline typename function::template result)>::type + inline typename boost::result_of & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const { BOOST_PP_CAT(fusion::vector,N) @@ -155,8 +155,8 @@ namespace boost return this->fnc_transformed(arg); } template - inline typename function::template result)>::type + inline typename boost::result_of & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) { BOOST_PP_CAT(fusion::vector,N) diff --git a/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp b/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp index ce205a43..6faf51be 100644 --- a/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp +++ b/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp @@ -22,7 +22,6 @@ #include #include -#include namespace boost { namespace fusion { @@ -33,17 +32,9 @@ namespace boost { namespace fusion struct void_; template class unfused_lvalue_args - : public detail::nullary_call_base - , Function> { Function fnc_transformed; - template - friend struct detail::nullary_call_base; - - typedef detail::nullary_call_base< - fusion::unfused_lvalue_args, Function > base; - typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; @@ -53,21 +44,26 @@ namespace boost { namespace fusion : fnc_transformed(f) { } - using base::operator(); - template - struct result - { }; + struct result; - template - struct result< Self const () > - : base::call_const_0_result_class - { }; + typedef typename boost::result_of< + function const (fusion::vector0 &) >::type call_const_0_result; - template - struct result< Self() > - : base::call_0_result_class - { }; + inline call_const_0_result operator()() const + { + fusion::vector0 arg; + return this->fnc_transformed(arg); + } + + typedef typename boost::result_of< + function (fusion::vector0 &) >::type call_0_result; + + inline call_0_result operator()() + { + fusion::vector0 arg; + return this->fnc_transformed(arg); + } #define BOOST_PP_FILENAME_1 \ @@ -102,21 +98,21 @@ namespace boost template struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) > - : function::template result< function const ( + : boost::result_of< function const ( BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, - typename detail::mref::type BOOST_PP_INTERCEPT) >)> + typename detail::mref::type BOOST_PP_INTERCEPT) > & )> { }; template struct result< Self(BOOST_PP_ENUM_PARAMS(N,T)) > - : function::template result< function ( + : boost::result_of< function ( BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, - typename detail::mref::type BOOST_PP_INTERCEPT) >)> + typename detail::mref::type BOOST_PP_INTERCEPT) > & )> { }; template - inline typename function::template result)>::type + inline typename boost::result_of & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const { BOOST_PP_CAT(fusion::vector,N)< @@ -126,8 +122,8 @@ namespace boost } template - inline typename function::template result)>::type + inline typename boost::result_of & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) { BOOST_PP_CAT(fusion::vector,N)< diff --git a/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp b/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp index 2320ecf9..230fee81 100644 --- a/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp +++ b/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp @@ -22,7 +22,6 @@ #include #include -#include namespace boost { namespace fusion { @@ -33,17 +32,9 @@ namespace boost { namespace fusion struct void_; template class unfused_rvalue_args - : public detail::nullary_call_base - , Function> { Function fnc_transformed; - template - friend struct detail::nullary_call_base; - - typedef detail::nullary_call_base< - fusion::unfused_rvalue_args, Function > base; - typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; @@ -53,21 +44,26 @@ namespace boost { namespace fusion : fnc_transformed(f) { } - using base::operator(); - template - struct result - { }; + struct result; - template - struct result< Self const () > - : base::call_const_0_result_class - { }; + typedef typename boost::result_of< + function const (fusion::vector0 &) >::type call_const_0_result; - template - struct result< Self() > - : base::call_0_result_class - { }; + inline call_const_0_result operator()() const + { + fusion::vector0 arg; + return this->fnc_transformed(arg); + } + + typedef typename boost::result_of< + function (fusion::vector0 &) >::type call_0_result; + + inline call_0_result operator()() + { + fusion::vector0 arg; + return this->fnc_transformed(arg); + } #define BOOST_PP_FILENAME_1 \ @@ -102,21 +98,21 @@ namespace boost template struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) > - : function::template result< function const ( + : boost::result_of< function const ( BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, - typename detail::cref::type BOOST_PP_INTERCEPT) >)> + typename detail::cref::type BOOST_PP_INTERCEPT) > & )> { }; template struct result< Self (BOOST_PP_ENUM_PARAMS(N,T)) > - : function::template result< function ( + : boost::result_of< function ( BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, - typename detail::cref::type BOOST_PP_INTERCEPT) >)> + typename detail::cref::type BOOST_PP_INTERCEPT) > & )> { }; template - inline typename function::template result)>::type + inline typename boost::result_of & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const { BOOST_PP_CAT(fusion::vector,N)< @@ -126,8 +122,8 @@ namespace boost } template - inline typename function::template result)>::type + inline typename boost::result_of & )>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) { BOOST_PP_CAT(fusion::vector,N)< diff --git a/include/boost/fusion/functional/adapter/unfused_typed.hpp b/include/boost/fusion/functional/adapter/unfused_typed.hpp index 2e0743c7..7a48b5ab 100644 --- a/include/boost/fusion/functional/adapter/unfused_typed.hpp +++ b/include/boost/fusion/functional/adapter/unfused_typed.hpp @@ -19,6 +19,8 @@ #include #include +#include + #include #include @@ -30,8 +32,7 @@ #include #include -#include -#include +#include namespace boost { namespace fusion @@ -44,59 +45,26 @@ namespace boost { namespace fusion namespace detail { template + long Arity = result_of::size::value > struct unfused_typed_impl; - - template ::type > - struct unfused_typed_next_base - { - // type of the next base class - typedef unfused_typed_impl - < Derived, Function, NextSeq, result_of::size::value, - has_type< typename Function::template result::type)> >::value - > - type; - }; - - template - struct unfused_typed_impl - : unfused_typed_next_base::type - { }; - - template - struct unfused_typed_impl - : nullary_call_base - { }; - - template - struct unfused_typed_impl - : nullary_call_base - { }; - } template class unfused_typed - : public detail::unfused_typed_next_base - < unfused_typed, - typename remove_const::type>::type, Sequence, Sequence - >::type + : public detail::unfused_typed_impl + < unfused_typed, typename detail::uncr::type, + Sequence > { Function fnc_transformed; - template - friend struct detail::unfused_typed_impl; - - template - friend struct detail::nullary_call_base; - - typedef typename remove_const::type>::type function; + typedef typename detail::uncr::type function; typedef typename detail::call_param::type func_const_fwd_t; - typedef typename detail::unfused_typed_next_base,function,Sequence,Sequence>::type base; + typedef typename detail::unfused_typed_impl< + unfused_typed,function,Sequence > base; + + template + friend struct detail::unfused_typed_impl; public: @@ -105,20 +73,44 @@ namespace boost { namespace fusion { } template - struct result - { }; - - template - struct result< Self const () > - : base::call_const_0_result_class - { }; - - template - struct result< Self() > - : base::call_0_result_class - { }; + struct result; }; + namespace detail + { + template + struct unfused_typed_impl + { + typedef fusion::vector0 arg_vector_t; + + public: + + typedef typename boost::result_of< + Function const (arg_vector_t &) > call_const_0_result; + + typedef typename boost::result_of< + Function(arg_vector_t &) > call_0_result; + + inline typename boost::result_of< + Function const (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) #include BOOST_PP_ITERATE() @@ -129,14 +121,12 @@ namespace boost { template struct result_of< boost::fusion::unfused_typed const () > - { - typedef typename boost::fusion::unfused_typed::call_const_0_result type; - }; + : boost::fusion::unfused_typed::call_const_0_result + { }; template struct result_of< boost::fusion::unfused_typed() > - { - typedef typename boost::fusion::unfused_typed::call_0_result type; - }; + : boost::fusion::unfused_typed::call_0_result + { }; } @@ -153,29 +143,31 @@ namespace boost { template - struct unfused_typed_impl - : unfused_typed_next_base::type + struct unfused_typed_impl + : unfused_typed_impl::type, BOOST_PP_DEC(N) > { - private: - typedef typename unfused_typed_next_base< - Derived,Function,Sequence>::type base; - - typedef typename remove_const::type>::type function; typedef typename result_of::as_vector::type arg_vector_t; protected: - typedef typename function:: - template result BOOST_PP_CAT(rc,N); - typedef typename function:: - template result BOOST_PP_CAT(r,N); + + typedef typename boost::result_of< + Function const (arg_vector_t &) > BOOST_PP_CAT(rc,N); + + typedef typename boost::result_of< + Function(arg_vector_t &) > BOOST_PP_CAT(r,N); + public: - using base::operator(); + using unfused_typed_impl< Derived,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 function::template result::type + inline typename boost::result_of< + Function const (arg_vector_t &) >::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const { arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a)); @@ -183,7 +175,8 @@ namespace boost } #if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) - inline typename function::template result::type + inline typename boost::result_of< + Function (arg_vector_t &) >::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) { arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a)); @@ -196,6 +189,7 @@ namespace boost } // namespace detail +#if N > 0 template template struct unfused_typed::result< @@ -203,13 +197,14 @@ namespace boost : BOOST_PP_CAT(base::rc,N) { }; -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) +# 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