mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-25 01:57:15 +02:00
result_of and polymorphic function obj compatibility
[SVN r37962]
This commit is contained in:
@ -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 <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
# include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
# include <boost/utility/result_of.hpp>
|
||||
|
||||
# include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
# 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 \
|
||||
<boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
|
||||
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
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N, typename fusion::detail::r2fp<A,
|
||||
>::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
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N, typename fusion::detail::r2fp<A,
|
||||
>::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
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N, typename fusion::detail::r2fp<A,
|
||||
>::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
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N, typename fusion::detail::r2fp<A,
|
||||
>::type BOOST_PP_INTERCEPT)>::type type;
|
||||
};
|
||||
|
||||
# undef N
|
||||
|
||||
#endif
|
||||
|
@ -12,17 +12,21 @@
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/has_type.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
struct reserved { };
|
||||
|
||||
template <class Derived, class Function, bool Enable = detail::has_type<
|
||||
typename remove_reference<Function>::type
|
||||
::template result<fusion::vector0> >::value>
|
||||
::template result<
|
||||
typename remove_const<typename remove_reference<Function>::type>::type(fusion::vector0)> >::value>
|
||||
struct nullary_call_base
|
||||
{
|
||||
template <typename T> inline void operator()(T reserved::*) const { }
|
||||
@ -34,19 +38,19 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct nullary_call_base<Derived,Function,true>
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<Function>::type function;
|
||||
typedef typename remove_const<typename remove_reference<Function>::type>::type function;
|
||||
protected:
|
||||
typedef typename function::template result<fusion::vector0> r0;
|
||||
typedef typename function::template result<function(vector0)> r0;
|
||||
public:
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
inline typename r0::type
|
||||
operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
inline typename r0::type
|
||||
operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
|
@ -12,17 +12,21 @@
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/has_type.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
struct reserved { };
|
||||
|
||||
template <class Derived, class Function, bool Enable = detail::has_type<
|
||||
typename remove_reference<Function>::type
|
||||
::template result<fusion::vector0> >::value>
|
||||
::template result<
|
||||
typename remove_const<typename remove_reference<Function>::type>::type(fusion::vector0)> >::value>
|
||||
struct nullary_call_base
|
||||
{
|
||||
template <typename T> inline void operator()(T reserved::*) const { }
|
||||
@ -34,19 +38,19 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct nullary_call_base<Derived,Function,true>
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<Function>::type function;
|
||||
typedef typename remove_const<typename remove_reference<Function>::type>::type function;
|
||||
protected:
|
||||
typedef typename function::template result<fusion::vector0> r0;
|
||||
typedef typename function::template result<function(vector0)> r0;
|
||||
public:
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
inline typename r0::type
|
||||
operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
inline typename r0::type
|
||||
operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
|
@ -62,17 +62,16 @@ namespace boost { namespace fusion
|
||||
return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
struct result
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template <typename Func, class Seq>
|
||||
struct result<fused<Func>(Seq)>
|
||||
: result_of::invoke<Function,Seq>
|
||||
{ };
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_PARAMS typename F
|
||||
#define BOOST_FUSION_CLASS_TPL_SPEC fusion::fused<F>
|
||||
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -67,17 +67,16 @@ namespace boost { namespace fusion
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
struct result
|
||||
: result_of::invoke_function_object<Function,Seq>
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template <typename Seq>
|
||||
struct result<fused_function_object(Seq)>
|
||||
: result_of::invoke_function_object<Function, Seq>
|
||||
{ };
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_PARAMS typename F
|
||||
#define BOOST_FUSION_CLASS_TPL_SPEC fusion::fused_function_object<F>
|
||||
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -33,7 +33,8 @@ namespace boost { namespace fusion
|
||||
|
||||
struct void_;
|
||||
|
||||
template <class Function> class unfused_generic
|
||||
template <class Function>
|
||||
class unfused_generic
|
||||
: public detail::nullary_call_base<unfused_generic<Function>, Function>
|
||||
{
|
||||
Function fnc_transformed;
|
||||
@ -44,7 +45,7 @@ namespace boost { namespace fusion
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_generic<Function>, Function > base;
|
||||
|
||||
typedef typename boost::remove_reference<Function>::type function;
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::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 <typename T>
|
||||
struct result;
|
||||
|
||||
template <class _>
|
||||
struct result<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT),_>
|
||||
template <typename Func>
|
||||
struct result<unfused_generic<Func>()>
|
||||
: base::r0
|
||||
{ };
|
||||
|
||||
#define BOOST_FUSION_CODE(tpl_params,arg_types,params,args) \
|
||||
template <tpl_params> \
|
||||
inline typename function::template result< \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> >::type \
|
||||
inline typename function::template result<function( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type \
|
||||
operator()(params) const \
|
||||
{ \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args); \
|
||||
return this->fnc_transformed(arg); \
|
||||
} \
|
||||
template <tpl_params> \
|
||||
inline typename function::template result< \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> >::type \
|
||||
inline typename function::template result<function( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type \
|
||||
operator()(params) \
|
||||
{ \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> 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<F>
|
||||
#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY
|
||||
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
namespace boost {
|
||||
template<typename Func>
|
||||
struct result_of<boost::fusion::unfused_generic<Func>()>
|
||||
{
|
||||
typedef boost::fusion::unfused_generic<Func> function;
|
||||
typedef typename function::template result<function()>::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 <boost/fusion/functional/adapter/detail/pt_def.hpp>
|
||||
|
||||
#if BOOST_PP_SLOT_1() == 0
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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)<
|
||||
<unfused_generic<Func>(BOOST_PP_ENUM_PARAMS(N,T))>
|
||||
: function::template result<function(BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::gref<T,>::type
|
||||
BOOST_PP_INTERCEPT) > >
|
||||
BOOST_PP_INTERCEPT) >)>
|
||||
{ };
|
||||
#endif
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector.hpp>
|
||||
|
||||
@ -43,7 +44,7 @@ namespace boost { namespace fusion
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_lvalue_args<Function>, Function > base;
|
||||
|
||||
typedef typename boost::remove_reference<Function>::type function;
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::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 <typename T>
|
||||
struct result;
|
||||
|
||||
template <typename _>
|
||||
struct result<BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT ), _ >
|
||||
template <typename Func>
|
||||
struct result<unfused_lvalue_args<Func>()>
|
||||
: 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<F>
|
||||
#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY
|
||||
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
namespace boost {
|
||||
template<typename Func>
|
||||
struct result_of<boost::fusion::unfused_lvalue_args<Func>()>
|
||||
{
|
||||
typedef boost::fusion::unfused_lvalue_args<Func> function;
|
||||
typedef typename function::template result<function()>::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 <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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)<
|
||||
<Func(BOOST_PP_ENUM_PARAMS(N,T))>
|
||||
: function::template result< function(BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::mref<T,>::type
|
||||
BOOST_PP_INTERCEPT) > >
|
||||
BOOST_PP_INTERCEPT) >)>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> >::type
|
||||
inline typename function::template result<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)) const
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
@ -115,8 +109,8 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> >::type
|
||||
inline typename function::template result<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))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector.hpp>
|
||||
|
||||
@ -43,7 +44,7 @@ namespace boost { namespace fusion
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_rvalue_args<Function>, Function > base;
|
||||
|
||||
typedef typename boost::remove_reference<Function>::type function;
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::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 <typename T>
|
||||
struct result;
|
||||
|
||||
template <typename _>
|
||||
struct result<BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT),_>
|
||||
template <typename Func>
|
||||
struct result<unfused_rvalue_args<Func>()>
|
||||
: 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<F>
|
||||
#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_RVALUE_ARG_MAX_ARITY
|
||||
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
namespace boost {
|
||||
template<typename Func>
|
||||
struct result_of<boost::fusion::unfused_rvalue_args<Func>()>
|
||||
{
|
||||
typedef boost::fusion::unfused_rvalue_args<Func> function;
|
||||
typedef typename function::template result<function()>::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 <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
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 <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result<Func(BOOST_PP_ENUM_PARAMS(N,T))>
|
||||
: function::template result<function( BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::cref<T,>::type
|
||||
BOOST_PP_INTERCEPT) > >
|
||||
BOOST_PP_INTERCEPT) >)>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> >::type
|
||||
inline typename function::template result<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)>)>::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 <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> >::type
|
||||
inline typename function::template result<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)>)>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
@ -53,8 +54,8 @@ namespace boost { namespace fusion
|
||||
// type of the next base class
|
||||
typedef unfused_typed_impl
|
||||
< Derived, Function, NextSeq, result_of::size<NextSeq>::value,
|
||||
has_type< typename Function::template result<
|
||||
typename result_of::as_vector<NextSeq>::type > >::value
|
||||
has_type< typename Function::template result<Function(
|
||||
typename result_of::as_vector<NextSeq>::type)> >::value
|
||||
>
|
||||
type;
|
||||
};
|
||||
@ -80,7 +81,7 @@ namespace boost { namespace fusion
|
||||
class unfused_typed
|
||||
: public detail::unfused_typed_next_base
|
||||
< unfused_typed<Function,Sequence>,
|
||||
typename remove_reference<Function>::type, Sequence, Sequence
|
||||
typename remove_const<typename remove_reference<Function>::type>::type, Sequence, Sequence
|
||||
>::type
|
||||
{
|
||||
Function fnc_transformed;
|
||||
@ -91,11 +92,11 @@ namespace boost { namespace fusion
|
||||
template <class D, class F, bool E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef typename boost::remove_reference<Function>::type function;
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
typedef typename detail::unfused_typed_next_base<unfused_typed<
|
||||
Function,Sequence>,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 <typename T>
|
||||
struct result;
|
||||
|
||||
template <typename _>
|
||||
struct result<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT),_>
|
||||
template <typename Func, typename Seq>
|
||||
struct result<unfused_typed<Func, Seq>()>
|
||||
: 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<F,S>
|
||||
#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY
|
||||
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
|
||||
namespace boost {
|
||||
template<typename Func, typename Seq>
|
||||
struct result_of<boost::fusion::unfused_typed<Func, Seq>()>
|
||||
{
|
||||
typedef boost::fusion::unfused_typed<Func, Seq> function;
|
||||
typedef typename function::template result<function()>::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<typename remove_reference<Function>::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<arg_vector_t> BOOST_PP_CAT(r,N);
|
||||
typedef typename function::
|
||||
template result<function(arg_vector_t)> BOOST_PP_CAT(r,N);
|
||||
|
||||
#define M(z,i,s) \
|
||||
typename call_param<typename result_of::value_at_c<s,i>::type>::type a##i
|
||||
|
||||
inline typename Function::template result<arg_vector_t>::type
|
||||
inline typename function::template result<function(arg_vector_t)>::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<arg_vector_t>::type
|
||||
inline typename function::template result<function(arg_vector_t)>::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 <class Function, class Sequence>
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct unfused_typed<Function,Sequence>::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
|
||||
<Func(BOOST_PP_ENUM_PARAMS(N,T))>
|
||||
: BOOST_PP_CAT(base::r,N)
|
||||
{ };
|
||||
|
||||
|
@ -17,9 +17,14 @@
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
@ -74,7 +79,7 @@ namespace boost { namespace fusion
|
||||
template <class Function, class Sequence> struct invoke_function_object
|
||||
: detail::invoke_function_object_impl<
|
||||
typename boost::remove_reference<Function>::type, Sequence
|
||||
>::template result<>
|
||||
>::template result<>
|
||||
{ };
|
||||
}
|
||||
|
||||
@ -114,11 +119,11 @@ namespace boost { namespace fusion
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: Function::template result <
|
||||
#define M(z,j,data) \
|
||||
typename boost::remove_reference< \
|
||||
typename result_of::value_at_c<Sequence,j>::type >::type
|
||||
BOOST_PP_ENUM(N,M,~) >
|
||||
: boost::result_of<
|
||||
typename remove_const<Function>::type (BOOST_PP_ENUM(N,M,~))>
|
||||
#undef M
|
||||
{ };
|
||||
|
||||
@ -138,12 +143,14 @@ namespace boost { namespace fusion
|
||||
private:
|
||||
typedef invoke_function_object_param_types<Sequence,N> seq;
|
||||
public:
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: Function::template result <
|
||||
BOOST_PP_ENUM_PARAMS(N,typename seq::T) >
|
||||
{ };
|
||||
|
||||
{
|
||||
typedef typename
|
||||
boost::result_of<
|
||||
typename remove_const<Function>::type (BOOST_PP_ENUM_PARAMS(N,typename seq::T))>::type type;
|
||||
};
|
||||
|
||||
template <class F>
|
||||
static inline typename result<F>::type
|
||||
|
Reference in New Issue
Block a user