diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index 37f351cb..b2bec5b0 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace boost { namespace fusion { namespace result_of @@ -25,14 +26,13 @@ namespace detail { template struct apply - { - typedef typename F::template result::type type; - }; + : boost::result_of + {}; }; template struct fold_apply - : mpl::apply, typename result_of::value_of::type, State> + : boost::result_of::type, State)> {}; template diff --git a/include/boost/fusion/algorithm/transformation/detail/replace.hpp b/include/boost/fusion/algorithm/transformation/detail/replace.hpp index 2c738c32..edaa74f5 100644 --- a/include/boost/fusion/algorithm/transformation/detail/replace.hpp +++ b/include/boost/fusion/algorithm/transformation/detail/replace.hpp @@ -43,16 +43,19 @@ namespace boost { namespace fusion { namespace detail replacer(T const& old_value, T const& new_value) : old_value(old_value), new_value(new_value) {} - template - struct result + template + struct result; + + template + struct result(U2)> { typedef typename - mpl::if_, U, U const&>::type + mpl::if_, U2, U2 const&>::type type; }; template - typename result::type + typename result::type operator()(U const& x) const { return replacer_helper::value>:: diff --git a/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp b/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp index 501297e0..0de8d2d6 100644 --- a/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp +++ b/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp @@ -43,8 +43,11 @@ namespace boost { namespace fusion { namespace detail replacer_if(F f, T const& new_value) : f(f), new_value(new_value) {} - template - struct result + template + struct result; + + template + struct result(U)> { typedef typename mpl::if_, U, U const&>::type @@ -52,7 +55,7 @@ namespace boost { namespace fusion { namespace detail }; template - typename result::type + typename result::type operator()(U const& x) const { return replacer_if_helper::value>:: diff --git a/include/boost/fusion/functional/adapter/detail/Attic/gen_result_of_spec.hpp b/include/boost/fusion/functional/adapter/detail/Attic/gen_result_of_spec.hpp deleted file mode 100644 index 29335dc3..00000000 --- a/include/boost/fusion/functional/adapter/detail/Attic/gen_result_of_spec.hpp +++ /dev/null @@ -1,102 +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). -==============================================================================*/ - -// No include guard - this file is included multiple times intentionally. - -#if !defined(BOOST_PP_IS_ITERATING) - -# if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_GEN_RESULT_OF_SPEC_HPP_INCLUDED) - -# include -# include -# include -# include -# include - -# include - -# include - -# define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_GEN_RESULT_OF_SPEC_HPP_INCLUDED -# endif - -# if !defined(BOOST_FUSION_CLASS_TPL_PARAMS) -# error "BOOST_FUSION_CLASS_TPL_PARAMS undefined" -# endif -# if !defined(BOOST_FUSION_CLASS_TPL_SPEC) -# error "BOOST_FUSION_CLASS_TPL_SPEC undefined" -# endif - -# if !defined(BOOST_FUSION_FUNC_OBJ_ARITY) -# define BOOST_PP_ITERATION_LIMITS (1,1) -# else -# define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUSION_FUNC_OBJ_ARITY) -# endif -# define BOOST_PP_FILENAME_1 \ - - -namespace boost -{ - #include BOOST_PP_ITERATE() -} - -# undef BOOST_FUSION_CLASS_TPL_PARAMS -# undef BOOST_FUSION_CLASS_TPL_SPEC -# if defined(BOOST_FUSION_FUNC_OBJ_ARITY) -# undef BOOST_FUSION_FUNC_OBJ_ARITY -# endif - -#else // defined(BOOST_PP_IS_ITERATING) -/////////////////////////////////////////////////////////////////////////////// -// -// Preprocessor vertical repetition code -// -/////////////////////////////////////////////////////////////////////////////// - -# define N BOOST_PP_ITERATION() - - template< BOOST_FUSION_CLASS_TPL_PARAMS - BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A) > - struct result_of< BOOST_FUSION_CLASS_TPL_SPEC (BOOST_PP_ENUM_PARAMS(N,A)) > - { - typedef typename BOOST_FUSION_CLASS_TPL_SPEC ::template result - ::type BOOST_PP_INTERCEPT)>::type type; - }; - - template< BOOST_FUSION_CLASS_TPL_PARAMS - BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A) > - struct result_of< BOOST_FUSION_CLASS_TPL_SPEC & (BOOST_PP_ENUM_PARAMS(N,A)) > - { - typedef typename BOOST_FUSION_CLASS_TPL_SPEC ::template result - ::type BOOST_PP_INTERCEPT)>::type type; - }; - - template< BOOST_FUSION_CLASS_TPL_PARAMS - BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A) > - struct result_of< BOOST_FUSION_CLASS_TPL_SPEC const (BOOST_PP_ENUM_PARAMS(N,A)) > - { - typedef typename BOOST_FUSION_CLASS_TPL_SPEC ::template result - ::type BOOST_PP_INTERCEPT)>::type type; - }; - - template< BOOST_FUSION_CLASS_TPL_PARAMS - BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A) > - struct result_of< BOOST_FUSION_CLASS_TPL_SPEC const & (BOOST_PP_ENUM_PARAMS(N,A)) > - { - typedef typename BOOST_FUSION_CLASS_TPL_SPEC ::template result - ::type BOOST_PP_INTERCEPT)>::type type; - }; - -# undef N - -#endif - 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 index efef076e..bdba4730 100644 --- a/include/boost/fusion/functional/adapter/detail/Attic/nullary_call_base.hpp +++ b/include/boost/fusion/functional/adapter/detail/Attic/nullary_call_base.hpp @@ -12,17 +12,21 @@ #include #include +#include #include #include +#include + namespace boost { namespace fusion { namespace detail { struct reserved { }; template ::type - ::template result >::value> + ::template result< + typename remove_const::type>::type(fusion::vector0)> >::value> struct nullary_call_base { template inline void operator()(T reserved::*) const { } @@ -34,19 +38,19 @@ namespace boost { namespace fusion { namespace detail struct nullary_call_base { private: - typedef typename remove_reference::type function; + typedef typename remove_const::type>::type function; protected: - typedef typename function::template result r0; + typedef typename function::template result r0; public: - inline typename function::template result::type + inline typename r0::type operator()() const { fusion::vector0 arg; return static_cast(this)->fnc_transformed(arg); } - inline typename function::template result::type + inline typename r0::type operator()() { fusion::vector0 arg; diff --git a/include/boost/fusion/functional/adapter/detail/nullary_call_base.hpp b/include/boost/fusion/functional/adapter/detail/nullary_call_base.hpp index efef076e..bdba4730 100644 --- a/include/boost/fusion/functional/adapter/detail/nullary_call_base.hpp +++ b/include/boost/fusion/functional/adapter/detail/nullary_call_base.hpp @@ -12,17 +12,21 @@ #include #include +#include #include #include +#include + namespace boost { namespace fusion { namespace detail { struct reserved { }; template ::type - ::template result >::value> + ::template result< + typename remove_const::type>::type(fusion::vector0)> >::value> struct nullary_call_base { template inline void operator()(T reserved::*) const { } @@ -34,19 +38,19 @@ namespace boost { namespace fusion { namespace detail struct nullary_call_base { private: - typedef typename remove_reference::type function; + typedef typename remove_const::type>::type function; protected: - typedef typename function::template result r0; + typedef typename function::template result r0; public: - inline typename function::template result::type + inline typename r0::type operator()() const { fusion::vector0 arg; return static_cast(this)->fnc_transformed(arg); } - inline typename function::template result::type + inline typename r0::type operator()() { fusion::vector0 arg; diff --git a/include/boost/fusion/functional/adapter/fused.hpp b/include/boost/fusion/functional/adapter/fused.hpp index 21c25d84..31947392 100644 --- a/include/boost/fusion/functional/adapter/fused.hpp +++ b/include/boost/fusion/functional/adapter/fused.hpp @@ -62,17 +62,16 @@ namespace boost { namespace fusion return fusion::invoke(this->fnc_transformed,s); } - template - struct result + template + struct result; + + template + struct result(Seq)> : result_of::invoke { }; }; }} -#define BOOST_FUSION_CLASS_TPL_PARAMS typename F -#define BOOST_FUSION_CLASS_TPL_SPEC fusion::fused -#include - #endif diff --git a/include/boost/fusion/functional/adapter/fused_function_object.hpp b/include/boost/fusion/functional/adapter/fused_function_object.hpp index 300b1d42..a73ad837 100644 --- a/include/boost/fusion/functional/adapter/fused_function_object.hpp +++ b/include/boost/fusion/functional/adapter/fused_function_object.hpp @@ -67,17 +67,16 @@ namespace boost { namespace fusion func_fwd_t >(this->fnc_transformed,s); } - template - struct result - : result_of::invoke_function_object + template + struct result; + + template + struct result + : result_of::invoke_function_object { }; }; }} -#define BOOST_FUSION_CLASS_TPL_PARAMS typename F -#define BOOST_FUSION_CLASS_TPL_SPEC fusion::fused_function_object -#include - #endif diff --git a/include/boost/fusion/functional/adapter/unfused_generic.hpp b/include/boost/fusion/functional/adapter/unfused_generic.hpp index 6cf811ee..60624076 100644 --- a/include/boost/fusion/functional/adapter/unfused_generic.hpp +++ b/include/boost/fusion/functional/adapter/unfused_generic.hpp @@ -33,7 +33,8 @@ namespace boost { namespace fusion struct void_; - template class unfused_generic + template + class unfused_generic : public detail::nullary_call_base, Function> { Function fnc_transformed; @@ -44,7 +45,7 @@ namespace boost { namespace fusion typedef detail::nullary_call_base< fusion::unfused_generic, Function > base; - typedef typename boost::remove_reference::type function; + typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; public: @@ -55,32 +56,26 @@ namespace boost { namespace fusion using base::operator(); - template < - BOOST_PP_ENUM_BINARY_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY, - typename T, = fusion::void_ BOOST_PP_INTERCEPT), - class _ = fusion::void_ - > + template struct result; - template - struct result< - BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY, - fusion::void_ BOOST_PP_INTERCEPT),_> + template + struct result()> : base::r0 { }; #define BOOST_FUSION_CODE(tpl_params,arg_types,params,args) \ template \ - inline typename function::template result< \ - BOOST_PP_CAT(fusion::vector,N) >::type \ + inline typename function::template result)>::type \ operator()(params) const \ { \ BOOST_PP_CAT(fusion::vector,N) arg(args); \ return this->fnc_transformed(arg); \ } \ template \ - inline typename function::template result< \ - BOOST_PP_CAT(fusion::vector,N) >::type \ + inline typename function::template result)>::type \ operator()(params) \ { \ BOOST_PP_CAT(fusion::vector,N) arg(args); \ @@ -100,10 +95,14 @@ namespace boost { namespace fusion }; }} -#define BOOST_FUSION_CLASS_TPL_PARAMS class F -#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_generic -#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY -#include +namespace boost { + template + struct result_of()> + { + typedef boost::fusion::unfused_generic function; + typedef typename function::template result::type type; + }; +} #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED #else // defined(BOOST_PP_IS_ITERATING) @@ -116,17 +115,12 @@ namespace boost { namespace fusion #include #if BOOST_PP_SLOT_1() == 0 - template + template struct result -#if N < BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY - < BOOST_PP_ENUM_PARAMS(N,T), - BOOST_PP_ENUM_PARAMS( - BOOST_PP_SUB(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,N), - fusion::void_ BOOST_PP_INTERCEPT), _ > -#endif - : function::template result< BOOST_PP_CAT(fusion::vector,N)< + (BOOST_PP_ENUM_PARAMS(N,T))> + : function::template result::type - BOOST_PP_INTERCEPT) > > + BOOST_PP_INTERCEPT) >)> { }; #endif diff --git a/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp b/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp index a0152fb2..25f547de 100644 --- a/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp +++ b/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp @@ -16,6 +16,7 @@ #include #include +#include #include @@ -43,7 +44,7 @@ namespace boost { namespace fusion typedef detail::nullary_call_base< fusion::unfused_lvalue_args, Function > base; - typedef typename boost::remove_reference::type function; + typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; public: @@ -54,17 +55,11 @@ namespace boost { namespace fusion using base::operator(); - template < - BOOST_PP_ENUM_BINARY_PARAMS( - BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY, - typename T, = fusion::void_ BOOST_PP_INTERCEPT ), - class _ = fusion::void_ > + template struct result; - template - struct result + template + struct result()> : base::r0 { }; @@ -76,10 +71,14 @@ namespace boost { namespace fusion }; }} -#define BOOST_FUSION_CLASS_TPL_PARAMS class F -#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_lvalue_args -#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY -#include +namespace boost { + template + struct result_of()> + { + typedef boost::fusion::unfused_lvalue_args function; + typedef typename function::template result::type type; + }; +} #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED #else // defined(BOOST_PP_IS_ITERATING) @@ -90,22 +89,17 @@ namespace boost { namespace fusion //////////////////////////////////////////////////////////////////////////////// #define N BOOST_PP_ITERATION() - template + template struct result -#if N < BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY - < BOOST_PP_ENUM_PARAMS(N,T), - BOOST_PP_ENUM_PARAMS( - BOOST_PP_SUB(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,N), - fusion::void_ BOOST_PP_INTERCEPT), _ > -#endif - : function::template result< BOOST_PP_CAT(fusion::vector,N)< + + : function::template result< function(BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::mref::type - BOOST_PP_INTERCEPT) > > + BOOST_PP_INTERCEPT) >)> { }; template - inline typename function::template result >::type + inline typename function::template result)>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const { BOOST_PP_CAT(fusion::vector,N)< @@ -115,8 +109,8 @@ namespace boost { namespace fusion } template - inline typename function::template result >::type + inline typename function::template result)>::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 21856bff..62b34463 100644 --- a/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp +++ b/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp @@ -16,6 +16,7 @@ #include #include +#include #include @@ -43,7 +44,7 @@ namespace boost { namespace fusion typedef detail::nullary_call_base< fusion::unfused_rvalue_args, Function > base; - typedef typename boost::remove_reference::type function; + typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; public: @@ -54,17 +55,11 @@ namespace boost { namespace fusion using base::operator(); - template < - BOOST_PP_ENUM_BINARY_PARAMS( - BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY, - typename T, = fusion::void_ BOOST_PP_INTERCEPT ), - class _ = fusion::void_ > + template struct result; - template - struct result + template + struct result()> : base::r0 { }; @@ -76,10 +71,14 @@ namespace boost { namespace fusion }; }} -#define BOOST_FUSION_CLASS_TPL_PARAMS class F -#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_rvalue_args -#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_RVALUE_ARG_MAX_ARITY -#include +namespace boost { + template + struct result_of()> + { + typedef boost::fusion::unfused_rvalue_args function; + typedef typename function::template result::type type; + }; +} #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED #else // defined(BOOST_PP_IS_ITERATING) @@ -90,22 +89,16 @@ namespace boost { namespace fusion //////////////////////////////////////////////////////////////////////////////// #define N BOOST_PP_ITERATION() - template - struct result -#if N < BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY - < BOOST_PP_ENUM_PARAMS(N,T), - BOOST_PP_ENUM_PARAMS( - BOOST_PP_SUB(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,N), - fusion::void_ BOOST_PP_INTERCEPT), _ > -#endif - : function::template result< BOOST_PP_CAT(fusion::vector,N)< + template + struct result + : function::template result::type - BOOST_PP_INTERCEPT) > > + BOOST_PP_INTERCEPT) >)> { }; template - inline typename function::template result >::type + inline typename function::template result)>::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const { BOOST_PP_CAT(fusion::vector,N)< @@ -115,8 +108,8 @@ namespace boost { namespace fusion } template - inline typename function::template result >::type + inline typename function::template result)>::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 b276f390..6f85b929 100644 --- a/include/boost/fusion/functional/adapter/unfused_typed.hpp +++ b/include/boost/fusion/functional/adapter/unfused_typed.hpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -53,8 +54,8 @@ namespace boost { namespace fusion // type of the next base class typedef unfused_typed_impl < Derived, Function, NextSeq, result_of::size::value, - has_type< typename Function::template result< - typename result_of::as_vector::type > >::value + has_type< typename Function::template result::type)> >::value > type; }; @@ -80,7 +81,7 @@ namespace boost { namespace fusion class unfused_typed : public detail::unfused_typed_next_base < unfused_typed, - typename remove_reference::type, Sequence, Sequence + typename remove_const::type>::type, Sequence, Sequence >::type { Function fnc_transformed; @@ -91,11 +92,11 @@ namespace boost { namespace fusion template friend struct detail::nullary_call_base; - typedef typename boost::remove_reference::type function; + typedef typename remove_const::type>::type function; typedef typename detail::call_param::type func_const_fwd_t; typedef typename detail::unfused_typed_next_base,function,Sequence,Sequence>::type base; + function, Sequence>,function,Sequence,Sequence>::type base; public: @@ -103,17 +104,11 @@ namespace boost { namespace fusion : fnc_transformed(f) { } - template < - BOOST_PP_ENUM_BINARY_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY, - typename T, = fusion::void_ BOOST_PP_INTERCEPT), - class _ = fusion::void_ - > + template struct result; - template - struct result< - BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY, - fusion::void_ BOOST_PP_INTERCEPT),_> + template + struct result()> : base::r0 { }; }; @@ -124,10 +119,14 @@ namespace boost { namespace fusion }} -#define BOOST_FUSION_CLASS_TPL_PARAMS class F, class S -#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_typed -#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY -#include +namespace boost { + template + struct result_of()> + { + typedef boost::fusion::unfused_typed function; + typedef typename function::template result::type type; + }; +} #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_TYPED_HPP_INCLUDED #else // defined(BOOST_PP_IS_ITERATING) @@ -149,6 +148,8 @@ namespace boost { namespace fusion typedef typename unfused_typed_next_base< Derived,Function,Sequence>::type base; + typedef typename remove_const::type>::type function; + // Notes: // - conversion to fusion::vector might not be perfect (there is // currently no "inrinsic converting ctor" that would allow us @@ -161,13 +162,13 @@ namespace boost { namespace fusion using base::operator(); - typedef typename Function:: - template result BOOST_PP_CAT(r,N); + typedef typename function:: + template result BOOST_PP_CAT(r,N); #define M(z,i,s) \ typename call_param::type>::type a##i - inline typename Function::template result::type + inline typename function::template result::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const { arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a)); @@ -175,7 +176,7 @@ namespace boost { namespace fusion } #if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) - inline typename Function::template result::type + inline typename function::template result::type operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) { arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a)); @@ -189,14 +190,9 @@ namespace boost { namespace fusion } // namespace detail template - template + template struct unfused_typed::result -#if N < BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY - < BOOST_PP_ENUM_PARAMS(N,T), - BOOST_PP_ENUM_PARAMS( - BOOST_PP_SUB(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,N), - fusion::void_ BOOST_PP_INTERCEPT), _ > -#endif + : BOOST_PP_CAT(base::r,N) { }; diff --git a/include/boost/fusion/functional/invocation/invoke_function_object.hpp b/include/boost/fusion/functional/invocation/invoke_function_object.hpp index b4372b23..f06fb771 100644 --- a/include/boost/fusion/functional/invocation/invoke_function_object.hpp +++ b/include/boost/fusion/functional/invocation/invoke_function_object.hpp @@ -17,9 +17,14 @@ #include #include +#include + #include #include +#include + +#include #include #include @@ -74,7 +79,7 @@ namespace boost { namespace fusion template struct invoke_function_object : detail::invoke_function_object_impl< typename boost::remove_reference::type, Sequence - >::template result<> + >::template result<> { }; } @@ -114,11 +119,11 @@ namespace boost { namespace fusion template struct result - : Function::template result < #define M(z,j,data) \ typename boost::remove_reference< \ typename result_of::value_at_c::type >::type - BOOST_PP_ENUM(N,M,~) > + : boost::result_of< + typename remove_const::type (BOOST_PP_ENUM(N,M,~))> #undef M { }; @@ -138,12 +143,14 @@ namespace boost { namespace fusion private: typedef invoke_function_object_param_types seq; public: - template struct result - : Function::template result < - BOOST_PP_ENUM_PARAMS(N,typename seq::T) > - { }; + + { + typedef typename + boost::result_of< + typename remove_const::type (BOOST_PP_ENUM_PARAMS(N,typename seq::T))>::type type; + }; template static inline typename result::type diff --git a/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp b/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp index 38267c62..73be3045 100644 --- a/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp +++ b/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp @@ -1,11 +1,14 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2007 Dan Marsden Distributed under 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(FUSION_APPLY_TRANSFORM_RESULT_02092006_1936) -#define FUSION_APPLY_TRANSFORM_RESULT_02092006_1936 +#if !defined(BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936) +#define BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936 + +#include namespace boost { namespace fusion { @@ -18,15 +21,13 @@ namespace boost { namespace fusion { template struct apply - { - typedef typename F::template result::type type; - }; + : boost::result_of + {}; template struct apply - { - typedef typename F::template result::type type; - }; + : boost::result_of + {}; }; } }} diff --git a/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp index f1f784f7..2e89b1da 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp @@ -21,13 +21,16 @@ namespace boost { namespace fusion { template struct poly_advance { - template - struct result + template + struct result; + + template + struct result(It)> : result_of::advance {}; template - typename result::type + typename result::type operator()(const It& it) const { return fusion::advance(it); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp index 353fb5eb..d90b5d05 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp @@ -30,8 +30,11 @@ namespace boost { namespace fusion template struct poly_at { - template - struct result + template + struct result; + + template + struct result(SeqRef)> : mpl::eval_if, mpl::identity, result_of::at::type, N> > @@ -40,14 +43,14 @@ namespace boost { namespace fusion }; template - typename result::type + typename result::type operator()(Seq& seq) const { return fusion::at(seq); } template - typename result::type + typename result::type operator()(Seq const& seq) const { return fusion::at(seq); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp index 37ed2a8d..c98eb7fc 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp @@ -27,8 +27,11 @@ namespace boost { namespace fusion { { struct poly_begin { + template + struct result; + template - struct result + struct result : mpl::eval_if, mpl::identity, result_of::begin::type> > @@ -37,14 +40,14 @@ namespace boost { namespace fusion { }; template - typename result::type + typename result::type operator()(Seq& seq) const { return fusion::begin(seq); } template - typename result::type + typename result::type operator()(Seq const& seq) const { return fusion::begin(seq); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp index ee7399fc..cb4c5445 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp @@ -25,15 +25,18 @@ namespace boost { namespace fusion { { struct poly_deref { + template + struct result; + template - struct result + struct result : mpl::eval_if, mpl::identity, result_of::deref > {}; template - typename result::type + typename result::type operator()(const It& it) const { return fusion::deref(it); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp index 9f4b66cc..a19b5c1f 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp @@ -41,8 +41,11 @@ namespace boost { namespace fusion { template struct endpoints { - template - struct result + template + struct result; + + template + struct result(SeqRef)> : mpl::eval_if, mpl::identity, get_endpoint > @@ -51,14 +54,14 @@ namespace boost { namespace fusion { }; template - typename result::type + typename result::type operator()(Seq& seq) const { return fusion::advance(fusion::begin(seq)); } template - typename result::type + typename result::type operator()(Seq const& seq) { return fusion::advance(fusion::begin(seq)); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp index b5b6e60d..0cec2882 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp @@ -24,15 +24,18 @@ namespace boost { namespace fusion { { struct poly_next { + template + struct result; + template - struct result + struct result : mpl::eval_if, mpl::identity, result_of::next > {}; template - typename result::type + typename result::type operator()(const It& it) const { return fusion::next(it); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp index c174e0cc..fdc409ca 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp @@ -24,15 +24,18 @@ namespace boost { namespace fusion { { struct poly_prior { + template + struct result; + template - struct result + struct result : mpl::eval_if, mpl::identity, result_of::prior > {}; template - typename result::type + typename result::type operator()(const It& it) const { return fusion::prior(it); diff --git a/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp b/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp index e69e2842..d7c922ac 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -38,21 +37,27 @@ namespace boost { namespace fusion { typedef Tag2 type; }; - template struct strictest_traversal_impl { - typedef StrictestSoFar tag1; - typedef typename traits::category_of< - typename remove_reference::type>::type tag2; + template + struct result; - typedef typename stricter_traversal::type type; + template + struct result + { + typedef StrictestSoFar tag1; + typedef typename traits::category_of< + typename remove_reference::type>::type tag2; + + typedef typename stricter_traversal::type type; + }; }; template struct strictest_traversal : result_of::fold< Sequence, fusion::random_access_traversal_tag, - strictest_traversal_impl > + strictest_traversal_impl> {}; } diff --git a/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp index 1fb298ec..ed5475ba 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp @@ -26,8 +26,11 @@ namespace boost { namespace fusion { template struct poly_value_at { - template - struct result + template + struct result; + + template + struct result(Seq)> : mpl::eval_if, mpl::identity, result_of::value_at::type, N> > diff --git a/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp index e8237ec1..9ea84a17 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp @@ -25,8 +25,11 @@ namespace boost { namespace fusion { { struct poly_value_of { + template + struct result; + template - struct result + struct result : mpl::eval_if, mpl::identity, result_of::value_of > diff --git a/include/boost/fusion/sequence/view/zip_view/zip_view.hpp b/include/boost/fusion/sequence/view/zip_view/zip_view.hpp index 9668abed..d23cb4df 100644 --- a/include/boost/fusion/sequence/view/zip_view/zip_view.hpp +++ b/include/boost/fusion/sequence/view/zip_view/zip_view.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -47,27 +48,31 @@ namespace boost { namespace fusion { struct seq_ref_size { - template::type, - bool HasSize = traits::is_forward::value - > - struct result - : result_of::size - {}; + template + struct result; - static int const int_max = static_cast( - static_cast(~0) >> 1); + template + struct result + { + static int const int_max = static_cast( + static_cast(~0) >> 1); - template - struct result - : mpl::int_ - {}; + typedef typename remove_reference::type SeqClass; + + typedef typename mpl::eval_if< + traits::is_forward, + result_of::size, + mpl::int_ >::type type; + }; }; struct poly_min { + template + struct result; + template - struct result + struct result : mpl::min {}; }; diff --git a/include/boost/fusion/support/deduce_sequence.hpp b/include/boost/fusion/support/deduce_sequence.hpp index 5adc6b7a..41ecbd1b 100644 --- a/include/boost/fusion/support/deduce_sequence.hpp +++ b/include/boost/fusion/support/deduce_sequence.hpp @@ -11,30 +11,30 @@ #include #include -#include +#include +#include namespace boost { namespace fusion { namespace traits { - template struct deduce_sequence; - //----- ---- --- -- - - - - - namespace detail { struct deducer { template - struct result + struct apply : fusion::traits::deduce { }; }; } + // We cannot use fusion::transform_view here as result_of looses cv qualifiers + // on built in types template struct deduce_sequence : result_of::as_vector< - fusion::transform_view > + typename mpl::transform::type> { }; }}} diff --git a/test/Jamfile b/test/Jamfile index 3c186062..b1967f19 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -5,7 +5,6 @@ # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) #============================================================================== - # bring in rules for testing import testing ; diff --git a/test/algorithm/fold.cpp b/test/algorithm/fold.cpp index adfc8ffb..6cefb99d 100644 --- a/test/algorithm/fold.cpp +++ b/test/algorithm/fold.cpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2007 Dan Marsden Distributed under 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) @@ -23,8 +24,11 @@ using boost::is_same; struct add_ints_only { + template + struct result; + template - struct result + struct result { typedef State type; }; @@ -45,8 +49,11 @@ struct add_ints_only struct count_ints { + template + struct result; + template - struct result + struct result { typedef typename if_< @@ -58,10 +65,10 @@ struct count_ints }; template - typename result::type + typename result::type operator()(T const&, CountT const&) const { - typedef typename result::type result; + typedef typename result::type result; return result(); } }; diff --git a/test/algorithm/transform.cpp b/test/algorithm/transform.cpp index c11bf258..eec0942d 100644 --- a/test/algorithm/transform.cpp +++ b/test/algorithm/transform.cpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2007 Dan Marsden Distributed under 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) @@ -18,8 +19,11 @@ struct square { + template + struct result; + template - struct result + struct result { BOOST_STATIC_ASSERT(!boost::is_reference::value); typedef int type; @@ -34,8 +38,11 @@ struct square struct add { + template + struct result; + template - struct result + struct result { typedef int type; }; diff --git a/test/functional/fused.cpp b/test/functional/fused.cpp index befe8c73..4b960ee0 100644 --- a/test/functional/fused.cpp +++ b/test/functional/fused.cpp @@ -15,6 +15,9 @@ #include #include +#include +#include + namespace fusion = boost::fusion; using boost::noncopyable; @@ -52,17 +55,33 @@ struct test_func int main() { test_func f; - fusion::fused< test_func<> > fused_func; - fusion::fused< test_func & > fused_func_ref(f); - fusion::fused< test_func<> const > fused_func_c; - fusion::fused< test_func<> > const fused_func_c2; - fusion::fused< test_func const & > fused_func_c_ref(f); - fusion::vector lv_vec(1,'\004'); + typedef fusion::fused< test_func<> > ff; + ff fused_func; + + typedef fusion::fused< test_func & > ffr; + ffr fused_func_ref(f); + + typedef fusion::fused< test_func<> const > ffc; + ffc fused_func_c; + + typedef fusion::fused< test_func<> > const ffc2; + ffc2 fused_func_c2; + + typedef fusion::fused< test_func const & > ffcr; + ffcr fused_func_c_ref(f); + + typedef fusion::vector vec; + vec lv_vec(1,'\004'); + + BOOST_MPL_ASSERT((boost::is_same::type, int>)); BOOST_TEST(fused_func(lv_vec) == 1); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); BOOST_TEST(fused_func_c(lv_vec) == 0); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); BOOST_TEST(fused_func_c2(lv_vec) == 0); BOOST_TEST(fused_func_ref(lv_vec) == 1); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); BOOST_TEST(fused_func_c_ref(lv_vec) == 0); BOOST_TEST(fused_func(fusion::make_vector(2,'\003')) == 1); diff --git a/test/functional/fused_function_object.cpp b/test/functional/fused_function_object.cpp index dd16aeef..911b7c69 100644 --- a/test/functional/fused_function_object.cpp +++ b/test/functional/fused_function_object.cpp @@ -22,8 +22,11 @@ template struct test_func : Base { - template - struct result + template + struct result; + + template + struct result(T0, T1)> { typedef int type; }; diff --git a/test/functional/invoke.cpp b/test/functional/invoke.cpp index 8b29a070..3ee2d6dc 100644 --- a/test/functional/invoke.cpp +++ b/test/functional/invoke.cpp @@ -40,10 +40,27 @@ struct object_nc : boost::noncopyable {}; struct fobj { - typedef int result_type; + // Handle nullary separately to exercise result_of support + template + struct result; - int operator()() { return 0; } - int operator()() const { return 1; } + template + struct result + { + typedef int type; + }; + + template + struct result + { + typedef int type; + }; + + template + struct result + { + typedef int type; + }; int operator()(int i) { return 2 + i; } int operator()(int i) const { return 3 + i; } @@ -57,16 +74,38 @@ struct fobj int operator()(int i, object &, object_nc &) const { return 11 + i; } }; +struct nullary_fobj +{ + typedef int result_type; + + int operator()() { return 0; } + int operator()() const { return 1; } +}; + struct fobj_nc : boost::noncopyable +{ + // Handle nullary separately to exercise result_of support + template + struct result; + + template + struct result + { + typedef int type; + }; + + int operator()(int i) { return 14 + i; } + int operator()(int i) const { return 15 + i; } +}; + +struct nullary_fobj_nc + : boost::noncopyable { typedef int result_type; int operator()() { return 12; } int operator()() const { return 13; } - - int operator()(int i) { return 14 + i; } - int operator()(int i) const { return 15 + i; } }; int nullary() { return 16; } @@ -147,7 +186,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<0>) { // Function Objects - fobj f; + nullary_fobj f; BOOST_TEST(f () == fusion::invoke(f , seq )); BOOST_TEST(f () == fusion::invoke(f , const_(seq))); @@ -155,16 +194,16 @@ void test_sequence_n(Sequence & seq, mpl::int_<0>) // Note: The function object is taken by value, so we request the copy // to be const with an explicit template argument. We can also request // the function object to be pased by reference... - BOOST_TEST(const_(f)() == fusion::invoke(const_(f), seq )); - BOOST_TEST(const_(f)() == fusion::invoke(const_(f), const_(seq))); + BOOST_TEST(const_(f)() == fusion::invoke(const_(f), seq )); + BOOST_TEST(const_(f)() == fusion::invoke(const_(f), const_(seq))); - fobj_nc nc_f; + nullary_fobj_nc nc_f; // ...and we further ensure there is no copying in this case, using a // noncopyable function object. - BOOST_TEST(nc_f () == fusion::invoke(nc_f , seq )); - BOOST_TEST(nc_f () == fusion::invoke(nc_f , const_(seq))); - BOOST_TEST(const_(nc_f)() == fusion::invoke(const_(nc_f), seq )); - BOOST_TEST(const_(nc_f)() == fusion::invoke(const_(nc_f), const_(seq))); + BOOST_TEST(nc_f () == fusion::invoke(nc_f , seq )); + BOOST_TEST(nc_f () == fusion::invoke(nc_f , const_(seq))); + BOOST_TEST(const_(nc_f)() == fusion::invoke(const_(nc_f), seq )); + BOOST_TEST(const_(nc_f)() == fusion::invoke(const_(nc_f), const_(seq))); // Builtin Functions diff --git a/test/functional/invoke_function_object.cpp b/test/functional/invoke_function_object.cpp index ead49b44..34a297e4 100644 --- a/test/functional/invoke_function_object.cpp +++ b/test/functional/invoke_function_object.cpp @@ -40,8 +40,24 @@ struct object_nc : boost::noncopyable {}; struct fobj { - template - struct result + // Handle nullary separately to exercise result_of support + template + struct result; + + template + struct result + { + typedef int type; + }; + + template + struct result + { + typedef int type; + }; + + template + struct result { typedef int type; }; @@ -61,22 +77,41 @@ struct fobj int operator()(int i, object &, object_nc &) const { return 11 + i; } }; +struct nullary_fobj +{ + typedef int result_type; + + int operator()() { return 0; } + int operator()() const { return 1; } +}; + struct fobj_nc : boost::noncopyable { - template - struct result + // Handle nullary separately to exercise result_of support + template + struct result; + + template + struct result { typedef int type; }; - - int operator()() { return 12; } - int operator()() const { return 13; } - + int operator()(int i) { return 14 + i; } int operator()(int i) const { return 15 + i; } }; +struct nullary_fobj_nc + : boost::noncopyable +{ + typedef int result_type; + + int operator()() { return 12; } + int operator()() const { return 13; } +}; + + typedef int element1_type; typedef object element2_type; typedef object_nc & element3_type; @@ -90,23 +125,23 @@ void test_sequence_n(Sequence & seq, mpl::int_<0>) { // Function Objects - fobj f; + nullary_fobj f; BOOST_TEST(f () == fusion::invoke_function_object(f , seq )); BOOST_TEST(f () == fusion::invoke_function_object(f , const_(seq))); // Note: The function object is taken by value, so we request the copy // to be const with an explicit template argument. We can also request // the function object to be pased by reference... - BOOST_TEST(const_(f)() == fusion::invoke_function_object(const_(f), seq )); - BOOST_TEST(const_(f)() == fusion::invoke_function_object(const_(f), const_(seq))); + BOOST_TEST(const_(f)() == fusion::invoke_function_object(const_(f), seq )); + BOOST_TEST(const_(f)() == fusion::invoke_function_object(const_(f), const_(seq))); - fobj_nc nc_f; + nullary_fobj_nc nc_f; // ...and we further ensure there is no copying in this case, using a // noncopyable function object. - BOOST_TEST(nc_f () == fusion::invoke_function_object(nc_f , seq )); - BOOST_TEST(nc_f () == fusion::invoke_function_object(nc_f , const_(seq))); - BOOST_TEST(const_(nc_f)() == fusion::invoke_function_object(const_(nc_f), seq )); - BOOST_TEST(const_(nc_f)() == fusion::invoke_function_object(const_(nc_f), const_(seq))); + BOOST_TEST(nc_f () == fusion::invoke_function_object(nc_f , seq )); + BOOST_TEST(nc_f () == fusion::invoke_function_object(nc_f , const_(seq))); + BOOST_TEST(const_(nc_f)() == fusion::invoke_function_object(const_(nc_f), seq )); + BOOST_TEST(const_(nc_f)() == fusion::invoke_function_object(const_(nc_f), const_(seq))); } template @@ -154,7 +189,7 @@ void result_type_tests() { using boost::is_same; - BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector<> >::type, int >::value )); + BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value )); BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector >::type, int >::value )); BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector >::type, int >::value )); } diff --git a/test/functional/make_fused_function_object.cpp b/test/functional/make_fused_function_object.cpp index 7b895f56..cd01834c 100644 --- a/test/functional/make_fused_function_object.cpp +++ b/test/functional/make_fused_function_object.cpp @@ -24,8 +24,14 @@ template struct test_func : Base { - template + template struct result + { + }; + + + template + struct result(T0, T1)> { typedef int type; }; diff --git a/test/functional/make_unfused_generic.cpp b/test/functional/make_unfused_generic.cpp index d0d793fb..7536f790 100644 --- a/test/functional/make_unfused_generic.cpp +++ b/test/functional/make_unfused_generic.cpp @@ -38,7 +38,11 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type { }; @@ -61,6 +65,8 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T const & elem, long value) const { @@ -73,10 +79,6 @@ struct test_func elem += sizeof(T); return value; } - - template struct result - : mpl::identity - { }; }; }; diff --git a/test/functional/make_unfused_lvalue_args.cpp b/test/functional/make_unfused_lvalue_args.cpp index 31288c7e..7a185740 100644 --- a/test/functional/make_unfused_lvalue_args.cpp +++ b/test/functional/make_unfused_lvalue_args.cpp @@ -37,7 +37,11 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type { }; @@ -60,16 +64,14 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T & elem, long value) const { elem += sizeof(T); return value + elem; } - - template struct result - : mpl::identity - { }; }; }; diff --git a/test/functional/make_unfused_rvalue_args.cpp b/test/functional/make_unfused_rvalue_args.cpp index 1e65d6d5..579d15ea 100644 --- a/test/functional/make_unfused_rvalue_args.cpp +++ b/test/functional/make_unfused_rvalue_args.cpp @@ -35,7 +35,11 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type { }; @@ -58,15 +62,13 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T const & elem, long value) const { return value + sizeof(T) * elem; } - - template struct result - : mpl::identity - { }; }; }; diff --git a/test/functional/unfused_generic.cpp b/test/functional/unfused_generic.cpp index cccf8f80..af4c7134 100644 --- a/test/functional/unfused_generic.cpp +++ b/test/functional/unfused_generic.cpp @@ -35,10 +35,14 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type - { }; + {}; template long operator()(Seq const & seq) const @@ -58,6 +62,8 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T const & elem, long value) const { @@ -70,10 +76,6 @@ struct test_func elem += sizeof(T); return value; } - - template struct result - : mpl::identity - { }; }; }; @@ -85,9 +87,9 @@ void result_type_tests() typedef fusion::unfused_generic< test_func > test_func_1; typedef fusion::unfused_generic< test_func > test_func_0; - BOOST_TEST(( has_type< test_func_0::result<> >::value )); - BOOST_TEST(( has_type< test_func_1::result >::value )); - BOOST_TEST(( ! has_type< test_func_1::result<> >::value )); + BOOST_TEST(( has_type< test_func_0::result >::value )); + BOOST_TEST(( has_type< test_func_1::result >::value )); + BOOST_TEST(( ! has_type< test_func_1::result >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_0() >::type, long >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_1(int) >::type, long >::value )); } diff --git a/test/functional/unfused_lvalue_args.cpp b/test/functional/unfused_lvalue_args.cpp index 9bb8660a..3919e527 100644 --- a/test/functional/unfused_lvalue_args.cpp +++ b/test/functional/unfused_lvalue_args.cpp @@ -32,7 +32,11 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type { }; @@ -55,16 +59,14 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T & elem, long value) const { elem += sizeof(T); return value + elem; } - - template struct result - : mpl::identity - { }; }; }; @@ -76,9 +78,9 @@ void result_type_tests() typedef fusion::unfused_lvalue_args< test_func > test_func_1; typedef fusion::unfused_lvalue_args< test_func > test_func_0; - BOOST_TEST(( has_type< test_func_0::result<> >::value )); - BOOST_TEST(( has_type< test_func_1::result >::value )); - BOOST_TEST(( ! has_type< test_func_1::result<> >::value )); + BOOST_TEST(( has_type< test_func_0::result >::value )); + BOOST_TEST(( has_type< test_func_1::result >::value )); + BOOST_TEST(( ! has_type< test_func_1::result >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_0() >::type, long >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_1(int) >::type, long >::value )); } diff --git a/test/functional/unfused_rvalue_args.cpp b/test/functional/unfused_rvalue_args.cpp index 4a05b0f4..b15f2f95 100644 --- a/test/functional/unfused_rvalue_args.cpp +++ b/test/functional/unfused_rvalue_args.cpp @@ -32,7 +32,11 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type { }; @@ -55,15 +59,13 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T const & elem, long value) const { return value + sizeof(T) * elem; } - - template struct result - : mpl::identity - { }; }; }; @@ -75,9 +77,9 @@ void result_type_tests() typedef fusion::unfused_rvalue_args< test_func > test_func_1; typedef fusion::unfused_rvalue_args< test_func > test_func_0; - BOOST_TEST(( has_type< test_func_0::result<> >::value )); - BOOST_TEST(( has_type< test_func_1::result >::value )); - BOOST_TEST(( ! has_type< test_func_1::result<> >::value )); + BOOST_TEST(( has_type< test_func_0::result >::value )); + BOOST_TEST(( has_type< test_func_1::result >::value )); + BOOST_TEST(( ! has_type< test_func_1::result >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_0() >::type, long >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_1(int) >::type, long >::value )); } diff --git a/test/functional/unfused_typed.cpp b/test/functional/unfused_typed.cpp index 01fd4efa..9e81444d 100644 --- a/test/functional/unfused_typed.cpp +++ b/test/functional/unfused_typed.cpp @@ -42,7 +42,11 @@ template struct test_func : Base { - template struct result + template + struct result; + + template + struct result(Seq)> : mpl::if_< typename mpl::apply::type, mpl::identity, boost::blank >::type { }; @@ -65,6 +69,8 @@ struct test_func struct fold_op { + typedef long result_type; + template long operator()(T const & elem, long value) const { @@ -77,10 +83,6 @@ struct test_func elem += sizeof(T); return value; } - - template struct result - : mpl::identity - { }; }; }; @@ -92,9 +94,9 @@ void result_type_tests() typedef fusion::unfused_typed< test_func, types > test_func_3; typedef fusion::unfused_typed< test_func, types > test_func_0; - BOOST_TEST(( has_type< test_func_0::result<> >::value )); - BOOST_TEST(( has_type< test_func_3::result >::value )); - BOOST_TEST(( ! has_type< test_func_3::result<> >::value )); + BOOST_TEST(( has_type< test_func_0::result >::value )); + BOOST_TEST(( has_type< test_func_3::result >::value )); + BOOST_TEST(( ! has_type< test_func_3::result >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_0() >::type, long >::value )); BOOST_TEST(( is_same< boost::result_of< test_func_3(long &, int, char) >::type, long >::value )); } diff --git a/test/sequence/transform_view.cpp b/test/sequence/transform_view.cpp index f8375a92..3dce9043 100644 --- a/test/sequence/transform_view.cpp +++ b/test/sequence/transform_view.cpp @@ -26,8 +26,11 @@ struct square { + template + struct result; + template - struct result + struct result { typedef int type; }; @@ -41,8 +44,11 @@ struct square struct add { + template + struct result; + template - struct result + struct result { typedef int type; };