mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-16 13:52:24 +02:00
makes unfused_* work exclusively through boost::result_of
[SVN r38198]
This commit is contained in:
@ -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 <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<typename Function>
|
||||
struct get_result_spec
|
||||
{
|
||||
private:
|
||||
typedef typename boost::remove_const<
|
||||
typename boost::remove_reference<Function>::type>::type function;
|
||||
|
||||
typedef fusion::vector0 arg;
|
||||
public:
|
||||
typedef typename function::template result<function(arg)> call_0_result;
|
||||
typedef typename function::template result<function const (arg)>
|
||||
call_const_0_result;
|
||||
};
|
||||
|
||||
template <class Derived, class Function,
|
||||
bool EnableConst = detail::has_type<
|
||||
typename get_result_spec<Function>::call_const_0_result>::value,
|
||||
bool Enable = detail::has_type<
|
||||
typename get_result_spec<Function>::call_0_result>::value>
|
||||
struct nullary_call_base
|
||||
{
|
||||
protected:
|
||||
typedef typename get_result_spec<Function>::call_const_0_result
|
||||
call_const_0_result_class;
|
||||
|
||||
typedef typename get_result_spec<Function>::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<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
typedef typename get_result_spec<Function>::call_0_result::type
|
||||
call_0_result;
|
||||
|
||||
inline call_0_result operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Derived, class Function>
|
||||
struct nullary_call_base<Derived, Function, true, false>
|
||||
{
|
||||
protected:
|
||||
typedef typename get_result_spec<Function>::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<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Derived, class Function>
|
||||
struct nullary_call_base<Derived, Function, false, true>
|
||||
{
|
||||
protected:
|
||||
typedef typename boost::blank call_const_0_result_class;
|
||||
|
||||
typedef typename get_result_spec<Function>::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<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Derived, class Function>
|
||||
struct nullary_call_base<Derived, Function, false, false>
|
||||
{
|
||||
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 <typename T> inline void operator()(T reserved::*) const { }
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -31,6 +31,11 @@ namespace boost { namespace fusion { namespace detail
|
||||
template <typename T> struct r2fp<T const> { typedef T const type; };
|
||||
template <typename T> struct r2fp<T &> { typedef T type; };
|
||||
|
||||
// remove_const< remove_reference<_> >
|
||||
template <typename T> struct uncr { typedef T type; };
|
||||
template <typename T> struct uncr<T const> { typedef T type; };
|
||||
template <typename T> struct uncr<T &> { typedef T type; };
|
||||
template <typename T> struct uncr<T const &> { typedef T type; };
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,9 @@
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -35,16 +37,9 @@ namespace boost { namespace fusion
|
||||
|
||||
template <class Function>
|
||||
class unfused_generic
|
||||
: public detail::nullary_call_base<unfused_generic<Function>, Function>
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
template <class D, class F, bool EC, bool E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_generic<Function>, Function > base;
|
||||
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
@ -54,34 +49,39 @@ namespace boost { namespace fusion
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
using base::operator();
|
||||
|
||||
template <typename Sig>
|
||||
struct result
|
||||
{ };
|
||||
struct result;
|
||||
|
||||
template <class Self>
|
||||
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 <class Self>
|
||||
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 <tpl_params> \
|
||||
inline typename function::template result<function const ( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type \
|
||||
inline typename boost::result_of<function const ( \
|
||||
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<function( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type \
|
||||
inline typename boost::result_of<function( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> & )>::type \
|
||||
operator()(params) \
|
||||
{ \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args); \
|
||||
@ -130,24 +130,24 @@ namespace boost
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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::gref<T,>::type BOOST_PP_INTERCEPT) >)>
|
||||
typename detail::gref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result
|
||||
< Self(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::result_of<function (
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::gref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400))
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<function const(
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>)>::type
|
||||
inline typename boost::result_of<function const(
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
|
||||
@ -155,8 +155,8 @@ namespace boost
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<function(
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>)>::type
|
||||
inline typename boost::result_of<function(
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -33,17 +32,9 @@ namespace boost { namespace fusion
|
||||
struct void_;
|
||||
|
||||
template <class Function> class unfused_lvalue_args
|
||||
: public detail::nullary_call_base
|
||||
<unfused_lvalue_args<Function>, Function>
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
template <class D, class F, bool EC, bool E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_lvalue_args<Function>, Function > base;
|
||||
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
@ -53,21 +44,26 @@ namespace boost { namespace fusion
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
using base::operator();
|
||||
|
||||
template <typename Sig>
|
||||
struct result
|
||||
{ };
|
||||
struct result;
|
||||
|
||||
template <class Self>
|
||||
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 <class Self>
|
||||
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 \
|
||||
<boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
|
||||
@ -102,21 +98,21 @@ namespace boost
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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<T,>::type BOOST_PP_INTERCEPT) >)>
|
||||
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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<T,>::type BOOST_PP_INTERCEPT) >)>
|
||||
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)>)>::type
|
||||
inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
@ -126,8 +122,8 @@ namespace boost
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)>)>::type
|
||||
inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -33,17 +32,9 @@ namespace boost { namespace fusion
|
||||
struct void_;
|
||||
|
||||
template <class Function> class unfused_rvalue_args
|
||||
: public detail::nullary_call_base
|
||||
<unfused_rvalue_args<Function>, Function>
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
template <class D, class F, bool EC, bool E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_rvalue_args<Function>, Function > base;
|
||||
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
@ -53,21 +44,26 @@ namespace boost { namespace fusion
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
using base::operator();
|
||||
|
||||
template <typename Sig>
|
||||
struct result
|
||||
{ };
|
||||
struct result;
|
||||
|
||||
template <class Self>
|
||||
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 <class Self>
|
||||
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 \
|
||||
<boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
|
||||
@ -102,21 +98,21 @@ namespace boost
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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<T,>::type BOOST_PP_INTERCEPT) >)>
|
||||
typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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<T,>::type BOOST_PP_INTERCEPT) >)>
|
||||
typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)>)>::type
|
||||
inline typename boost::result_of<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)<
|
||||
@ -126,8 +122,8 @@ namespace boost
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename function::template result<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)>)>::type
|
||||
inline typename boost::result_of<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)<
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
@ -30,8 +32,7 @@
|
||||
#include <boost/fusion/algorithm/transformation/pop_back.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/has_type.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace fusion
|
||||
@ -44,59 +45,26 @@ namespace boost { namespace fusion
|
||||
namespace detail
|
||||
{
|
||||
template <class Derived, class Function, class Sequence,
|
||||
long Arity, bool EnableCallOp>
|
||||
long Arity = result_of::size<Sequence>::value >
|
||||
struct unfused_typed_impl;
|
||||
|
||||
template <class Derived, class Function, class Sequence,
|
||||
class NextSeq = typename result_of::pop_back<Sequence>::type >
|
||||
struct unfused_typed_next_base
|
||||
{
|
||||
// type of the next base class
|
||||
typedef unfused_typed_impl
|
||||
< Derived, Function, NextSeq, result_of::size<NextSeq>::value,
|
||||
has_type< typename Function::template result<Function(
|
||||
typename result_of::as_vector<NextSeq>::type)> >::value
|
||||
>
|
||||
type;
|
||||
};
|
||||
|
||||
template <class Derived, class Function, class Sequence, long Arity>
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,Arity,false>
|
||||
: unfused_typed_next_base<Derived,Function,Sequence>::type
|
||||
{ };
|
||||
|
||||
template <class Derived, class Function, class Sequence>
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,0,false>
|
||||
: nullary_call_base<Derived,Function,false>
|
||||
{ };
|
||||
|
||||
template <class Derived, class Function, class Sequence>
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,0,true>
|
||||
: nullary_call_base<Derived,Function,true>
|
||||
{ };
|
||||
|
||||
}
|
||||
|
||||
template <class Function, class Sequence>
|
||||
class unfused_typed
|
||||
: public detail::unfused_typed_next_base
|
||||
< unfused_typed<Function,Sequence>,
|
||||
typename remove_const<typename remove_reference<Function>::type>::type, Sequence, Sequence
|
||||
>::type
|
||||
: public detail::unfused_typed_impl
|
||||
< unfused_typed<Function,Sequence>, typename detail::uncr<Function>::type,
|
||||
Sequence >
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
template <class D, class F, class S, long A, bool EO>
|
||||
friend struct detail::unfused_typed_impl;
|
||||
|
||||
template <class D, class F, bool EC, bool E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef typename remove_const<typename boost::remove_reference<Function>::type>::type function;
|
||||
typedef typename detail::uncr<Function>::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;
|
||||
typedef typename detail::unfused_typed_impl<
|
||||
unfused_typed<Function,Sequence>,function,Sequence > base;
|
||||
|
||||
template <class D, class F, class S, long A>
|
||||
friend struct detail::unfused_typed_impl;
|
||||
|
||||
public:
|
||||
|
||||
@ -105,20 +73,44 @@ namespace boost { namespace fusion
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result
|
||||
{ };
|
||||
|
||||
template <class Self>
|
||||
struct result< Self const () >
|
||||
: base::call_const_0_result_class
|
||||
{ };
|
||||
|
||||
template <class Self>
|
||||
struct result< Self() >
|
||||
: base::call_0_result_class
|
||||
{ };
|
||||
struct result;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Derived, class Function, class Sequence>
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,0>
|
||||
{
|
||||
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<Derived const *>(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<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/functional/adapter/unfused_typed.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
@ -129,14 +121,12 @@ namespace boost
|
||||
{
|
||||
template<class F, class Seq>
|
||||
struct result_of< boost::fusion::unfused_typed<F,Seq> const () >
|
||||
{
|
||||
typedef typename boost::fusion::unfused_typed<F,Seq>::call_const_0_result type;
|
||||
};
|
||||
: boost::fusion::unfused_typed<F,Seq>::call_const_0_result
|
||||
{ };
|
||||
template<class F, class Seq>
|
||||
struct result_of< boost::fusion::unfused_typed<F,Seq>() >
|
||||
{
|
||||
typedef typename boost::fusion::unfused_typed<F,Seq>::call_0_result type;
|
||||
};
|
||||
: boost::fusion::unfused_typed<F,Seq>::call_0_result
|
||||
{ };
|
||||
}
|
||||
|
||||
|
||||
@ -153,29 +143,31 @@ namespace boost
|
||||
{
|
||||
|
||||
template <class Derived, class Function, class Sequence>
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,N,true>
|
||||
: unfused_typed_next_base<Derived,Function,Sequence>::type
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,N>
|
||||
: unfused_typed_impl<Derived,Function,
|
||||
typename result_of::pop_back<Sequence>::type, BOOST_PP_DEC(N) >
|
||||
{
|
||||
private:
|
||||
typedef typename unfused_typed_next_base<
|
||||
Derived,Function,Sequence>::type base;
|
||||
|
||||
typedef typename remove_const<typename remove_reference<Function>::type>::type function;
|
||||
typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
|
||||
|
||||
protected:
|
||||
typedef typename function::
|
||||
template result<function const (arg_vector_t)> BOOST_PP_CAT(rc,N);
|
||||
typedef typename function::
|
||||
template result<function(arg_vector_t)> 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<Sequence>::type, BOOST_PP_DEC(N)
|
||||
>::operator();
|
||||
|
||||
#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<function const (arg_vector_t)>::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<function(arg_vector_t)>::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 <class Function, class Sequence>
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct unfused_typed<Function,Sequence>::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 <class Function, class Sequence>
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct unfused_typed<Function,Sequence>::result<
|
||||
Self (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: BOOST_PP_CAT(base::r,N)
|
||||
{ };
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
|
Reference in New Issue
Block a user