mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-21 16:22:45 +02:00
result_of and polymorphic function obj compatibility
[SVN r37962]
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
namespace result_of
|
||||
@ -25,14 +26,13 @@ namespace detail
|
||||
{
|
||||
template <typename Value, typename State>
|
||||
struct apply
|
||||
{
|
||||
typedef typename F::template result<Value, State>::type type;
|
||||
};
|
||||
: boost::result_of<F(Value,State)>
|
||||
{};
|
||||
};
|
||||
|
||||
template <typename Iterator, typename State, typename F>
|
||||
struct fold_apply
|
||||
: mpl::apply<apply_fold_result<F>, typename result_of::value_of<Iterator>::type, State>
|
||||
: boost::result_of<F(typename result_of::value_of<Iterator>::type, State)>
|
||||
{};
|
||||
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
|
@ -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 <typename U>
|
||||
struct result
|
||||
template<typename Params>
|
||||
struct result;
|
||||
|
||||
template <typename U1, typename U2>
|
||||
struct result<replacer<U1>(U2)>
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<is_convertible<T, U>, U, U const&>::type
|
||||
mpl::if_<is_convertible<T, U2>, U2, U2 const&>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
typename result<U>::type
|
||||
typename result<replacer(U)>::type
|
||||
operator()(U const& x) const
|
||||
{
|
||||
return replacer_helper<is_convertible<T, U>::value>::
|
||||
|
@ -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 <typename U>
|
||||
struct result
|
||||
template<typename Params>
|
||||
struct result;
|
||||
|
||||
template <typename F1, typename T1, typename U>
|
||||
struct result<replacer_if<F1, T1>(U)>
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<is_convertible<T, U>, U, U const&>::type
|
||||
@ -52,7 +55,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
typename result<U>::type
|
||||
typename result<replacer_if(U)>::type
|
||||
operator()(U const& x) const
|
||||
{
|
||||
return replacer_if_helper<is_convertible<T, U>::value>::
|
||||
|
@ -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
|
||||
|
@ -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 <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -18,15 +21,13 @@ namespace boost { namespace fusion
|
||||
{
|
||||
template <typename T0, typename T1 = void_>
|
||||
struct apply
|
||||
{
|
||||
typedef typename F::template result<T0, T1>::type type;
|
||||
};
|
||||
: boost::result_of<F(T0, T1)>
|
||||
{};
|
||||
|
||||
template <typename T0>
|
||||
struct apply<T0, void_>
|
||||
{
|
||||
typedef typename F::template result<T0>::type type;
|
||||
};
|
||||
: boost::result_of<F(T0)>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
@ -21,13 +21,16 @@ namespace boost { namespace fusion {
|
||||
template<typename N>
|
||||
struct poly_advance
|
||||
{
|
||||
template<typename It>
|
||||
struct result
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename N1, typename It>
|
||||
struct result<poly_advance<N1>(It)>
|
||||
: result_of::advance<It,N>
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
typename result<poly_advance(It)>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::advance<N>(it);
|
||||
|
@ -30,8 +30,11 @@ namespace boost { namespace fusion
|
||||
template<typename N>
|
||||
struct poly_at
|
||||
{
|
||||
template<typename SeqRef>
|
||||
struct result
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename N1, typename SeqRef>
|
||||
struct result<poly_at<N1>(SeqRef)>
|
||||
: mpl::eval_if<is_same<SeqRef, unused_type const&>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::at<typename remove_reference<SeqRef>::type, N> >
|
||||
@ -40,14 +43,14 @@ namespace boost { namespace fusion
|
||||
};
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq&>::type
|
||||
typename result<poly_at(Seq&)>::type
|
||||
operator()(Seq& seq) const
|
||||
{
|
||||
return fusion::at<N>(seq);
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq const&>::type
|
||||
typename result<poly_at(Seq const&)>::type
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::at<N>(seq);
|
||||
|
@ -27,8 +27,11 @@ namespace boost { namespace fusion {
|
||||
{
|
||||
struct poly_begin
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename SeqRef>
|
||||
struct result
|
||||
struct result<poly_begin(SeqRef)>
|
||||
: mpl::eval_if<is_same<SeqRef, unused_type const&>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::begin<typename remove_reference<SeqRef>::type> >
|
||||
@ -37,14 +40,14 @@ namespace boost { namespace fusion {
|
||||
};
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq&>::type
|
||||
typename result<poly_begin(Seq&)>::type
|
||||
operator()(Seq& seq) const
|
||||
{
|
||||
return fusion::begin(seq);
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq const&>::type
|
||||
typename result<poly_begin(Seq const&)>::type
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::begin(seq);
|
||||
|
@ -25,15 +25,18 @@ namespace boost { namespace fusion {
|
||||
{
|
||||
struct poly_deref
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename It>
|
||||
struct result
|
||||
struct result<poly_deref(It)>
|
||||
: mpl::eval_if<is_same<It, unused_type>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::deref<It> >
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
typename result<poly_deref(It)>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::deref(it);
|
||||
|
@ -41,8 +41,11 @@ namespace boost { namespace fusion {
|
||||
template<typename M>
|
||||
struct endpoints
|
||||
{
|
||||
template<typename SeqRef>
|
||||
struct result
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename M1, typename SeqRef>
|
||||
struct result<endpoints<M1>(SeqRef)>
|
||||
: mpl::eval_if<is_same<SeqRef, unused_type const&>,
|
||||
mpl::identity<unused_type>,
|
||||
get_endpoint<SeqRef, M> >
|
||||
@ -51,14 +54,14 @@ namespace boost { namespace fusion {
|
||||
};
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq&>::type
|
||||
typename result<endpoints(Seq&)>::type
|
||||
operator()(Seq& seq) const
|
||||
{
|
||||
return fusion::advance<M>(fusion::begin(seq));
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq const&>::type
|
||||
typename result<endpoints(Seq const&)>::type
|
||||
operator()(Seq const& seq)
|
||||
{
|
||||
return fusion::advance<M>(fusion::begin(seq));
|
||||
|
@ -24,15 +24,18 @@ namespace boost { namespace fusion {
|
||||
{
|
||||
struct poly_next
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename It>
|
||||
struct result
|
||||
struct result<poly_next(It)>
|
||||
: mpl::eval_if<is_same<It, unused_type>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::next<It> >
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
typename result<poly_next(It)>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::next(it);
|
||||
|
@ -24,15 +24,18 @@ namespace boost { namespace fusion {
|
||||
{
|
||||
struct poly_prior
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename It>
|
||||
struct result
|
||||
struct result<poly_prior(It)>
|
||||
: mpl::eval_if<is_same<It, unused_type>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::prior<It> >
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
typename result<poly_prior(It)>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::prior(it);
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/mpl.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
@ -38,21 +37,27 @@ namespace boost { namespace fusion {
|
||||
typedef Tag2 type;
|
||||
};
|
||||
|
||||
template<typename Next, typename StrictestSoFar>
|
||||
struct strictest_traversal_impl
|
||||
{
|
||||
typedef StrictestSoFar tag1;
|
||||
typedef typename traits::category_of<
|
||||
typename remove_reference<Next>::type>::type tag2;
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
typedef typename stricter_traversal<tag1,tag2>::type type;
|
||||
template<typename Next, typename StrictestSoFar>
|
||||
struct result<strictest_traversal_impl(Next, StrictestSoFar)>
|
||||
{
|
||||
typedef StrictestSoFar tag1;
|
||||
typedef typename traits::category_of<
|
||||
typename remove_reference<Next>::type>::type tag2;
|
||||
|
||||
typedef typename stricter_traversal<tag1,tag2>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
struct strictest_traversal
|
||||
: result_of::fold<
|
||||
Sequence, fusion::random_access_traversal_tag,
|
||||
strictest_traversal_impl<boost::mpl::_,boost::mpl::_> >
|
||||
strictest_traversal_impl>
|
||||
{};
|
||||
|
||||
}
|
||||
|
@ -26,8 +26,11 @@ namespace boost { namespace fusion {
|
||||
template<typename N>
|
||||
struct poly_value_at
|
||||
{
|
||||
template<typename Seq>
|
||||
struct result
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename N1, typename Seq>
|
||||
struct result<poly_value_at<N1>(Seq)>
|
||||
: mpl::eval_if<is_same<Seq, unused_type const&>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_at<typename remove_reference<Seq>::type, N> >
|
||||
|
@ -25,8 +25,11 @@ namespace boost { namespace fusion {
|
||||
{
|
||||
struct poly_value_of
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename It>
|
||||
struct result
|
||||
struct result<poly_value_of(It)>
|
||||
: mpl::eval_if<is_same<It, unused_type>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_of<It> >
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
@ -47,27 +48,31 @@ namespace boost { namespace fusion {
|
||||
|
||||
struct seq_ref_size
|
||||
{
|
||||
template<typename Seq,
|
||||
typename SeqClass = typename remove_reference<Seq>::type,
|
||||
bool HasSize = traits::is_forward<SeqClass>::value
|
||||
>
|
||||
struct result
|
||||
: result_of::size<SeqClass>
|
||||
{};
|
||||
template<typename Params>
|
||||
struct result;
|
||||
|
||||
static int const int_max = static_cast<int>(
|
||||
static_cast<unsigned>(~0) >> 1);
|
||||
template<typename Seq>
|
||||
struct result<seq_ref_size(Seq)>
|
||||
{
|
||||
static int const int_max = static_cast<int>(
|
||||
static_cast<unsigned>(~0) >> 1);
|
||||
|
||||
template<typename Seq, typename SeqClass>
|
||||
struct result<Seq, SeqClass, false>
|
||||
: mpl::int_<int_max>
|
||||
{};
|
||||
typedef typename remove_reference<Seq>::type SeqClass;
|
||||
|
||||
typedef typename mpl::eval_if<
|
||||
traits::is_forward<SeqClass>,
|
||||
result_of::size<SeqClass>,
|
||||
mpl::int_<int_max> >::type type;
|
||||
};
|
||||
};
|
||||
|
||||
struct poly_min
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename Lhs, typename Rhs>
|
||||
struct result
|
||||
struct result<poly_min(Lhs, Rhs)>
|
||||
: mpl::min<Lhs, Rhs>
|
||||
{};
|
||||
};
|
||||
|
@ -11,30 +11,30 @@
|
||||
|
||||
#include <boost/fusion/support/deduce.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/mpl.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace traits
|
||||
{
|
||||
|
||||
template <class Sequence> struct deduce_sequence;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct deducer
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
struct apply
|
||||
: fusion::traits::deduce<T>
|
||||
{ };
|
||||
};
|
||||
}
|
||||
|
||||
// We cannot use fusion::transform_view here as result_of looses cv qualifiers
|
||||
// on built in types
|
||||
template <class Sequence>
|
||||
struct deduce_sequence
|
||||
: result_of::as_vector<
|
||||
fusion::transform_view<Sequence, detail::deducer> >
|
||||
typename mpl::transform<Sequence, detail::deducer>::type>
|
||||
{ };
|
||||
|
||||
}}}
|
||||
|
Reference in New Issue
Block a user