forked from boostorg/fusion
creating branch for fusion 2.1
[SVN r40232]
This commit is contained in:
41
include/boost/fusion/functional/adapter/detail/access.hpp
Normal file
41
include/boost/fusion/functional/adapter/detail/access.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
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_ACCESS_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_ACCESS_HPP_INCLUDED
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
// const reference deduction for function templates that accept T const &
|
||||
template <typename T> struct cref { typedef T const& type; };
|
||||
template <typename T> struct cref<T&> { typedef T const& type; };
|
||||
template <typename T> struct cref<T const> { typedef T const& type; };
|
||||
|
||||
// mutable reference deduction for function templates that accept T &
|
||||
template <typename T> struct mref { typedef T & type; };
|
||||
template <typename T> struct mref<T&> { typedef T & type; };
|
||||
|
||||
// generic reference deduction for function templates that are overloaded
|
||||
// to accept both T const & and T &
|
||||
template <typename T> struct gref { typedef T const& type; };
|
||||
template <typename T> struct gref<T&> { typedef T & type; };
|
||||
template <typename T> struct gref<T const> { typedef T const& type; };
|
||||
|
||||
// appropriately qualified target function in const context
|
||||
template <typename T> struct qf_c { typedef T const type; };
|
||||
template <typename T> struct qf_c<T const> { typedef T const type; };
|
||||
template <typename T> struct qf_c<T &> { typedef T type; };
|
||||
|
||||
// appropriately qualified target function in non-const context
|
||||
template <typename T> struct qf { typedef T type; };
|
||||
template <typename T> struct qf<T const> { typedef T const type; };
|
||||
template <typename T> struct qf<T &> { typedef T type; };
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
118
include/boost/fusion/functional/adapter/detail/pow2_explode.hpp
Normal file
118
include/boost/fusion/functional/adapter/detail/pow2_explode.hpp
Normal file
@ -0,0 +1,118 @@
|
||||
/*=============================================================================
|
||||
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_PP_IS_ITERATING)
|
||||
# error "This file has to be included by a preprocessor loop construct!"
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1
|
||||
|
||||
# if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_POW2_EXPLODE_HPP_INCLUDED)
|
||||
# include <boost/preprocessor/config/limits.hpp>
|
||||
# include <boost/preprocessor/slot/slot.hpp>
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
# define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_POW2_EXPLODE_HPP_INCLUDED
|
||||
# endif
|
||||
|
||||
# define BOOST_PP_VALUE 0
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
|
||||
# define BOOST_PP_FILENAME_2 \
|
||||
<boost/fusion/functional/adapter/detail/pow2_explode.hpp>
|
||||
# define BOOST_PP_VALUE (1 << N) >> 4
|
||||
# if BOOST_PP_VALUE > BOOST_PP_LIMIT_ITERATION
|
||||
# error "Preprocessor limit exceeded."
|
||||
# endif
|
||||
|
||||
# include BOOST_PP_ASSIGN_SLOT(2)
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,BOOST_PP_DEC(BOOST_PP_SLOT_2()))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 2
|
||||
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
71
include/boost/fusion/functional/adapter/detail/pt_def.hpp
Normal file
71
include/boost/fusion/functional/adapter/detail/pt_def.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*=============================================================================
|
||||
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 BOOST_PP_SLOT_1() & 0x001
|
||||
# define PT0 T0 &
|
||||
#else
|
||||
# define PT0 T0 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x002
|
||||
# define PT1 T1 &
|
||||
#else
|
||||
# define PT1 T1 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x004
|
||||
# define PT2 T2 &
|
||||
#else
|
||||
# define PT2 T2 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x008
|
||||
# define PT3 T3 &
|
||||
#else
|
||||
# define PT3 T3 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x010
|
||||
# define PT4 T4 &
|
||||
#else
|
||||
# define PT4 T4 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x020
|
||||
# define PT5 T5 &
|
||||
#else
|
||||
# define PT5 T5 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x040
|
||||
# define PT6 T6 &
|
||||
#else
|
||||
# define PT6 T6 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x080
|
||||
# define PT7 T7 &
|
||||
#else
|
||||
# define PT7 T7 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x100
|
||||
# define PT8 T8 &
|
||||
#else
|
||||
# define PT8 T8 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x200
|
||||
# define PT9 T9 &
|
||||
#else
|
||||
# define PT9 T9 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x400
|
||||
# define PT10 T10 &
|
||||
#else
|
||||
# define PT10 T10 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x800
|
||||
# define PT11 T11 &
|
||||
#else
|
||||
# define PT11 T11 const &
|
||||
#endif
|
||||
|
23
include/boost/fusion/functional/adapter/detail/pt_undef.hpp
Normal file
23
include/boost/fusion/functional/adapter/detail/pt_undef.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*=============================================================================
|
||||
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.
|
||||
|
||||
#undef PT0
|
||||
#undef PT1
|
||||
#undef PT2
|
||||
#undef PT3
|
||||
#undef PT4
|
||||
#undef PT5
|
||||
#undef PT6
|
||||
#undef PT7
|
||||
#undef PT8
|
||||
#undef PT9
|
||||
#undef PT10
|
||||
#undef PT11
|
||||
|
85
include/boost/fusion/functional/adapter/fused.hpp
Normal file
85
include/boost/fusion/functional/adapter/fused.hpp
Normal file
@ -0,0 +1,85 @@
|
||||
/*=============================================================================
|
||||
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_FUSED_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Function> class fused;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <typename Function>
|
||||
class fused
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type & func_const_fwd_t;
|
||||
typedef typename detail::qf<Function>::type & func_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit fused(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke<func_const_fwd_t,Seq const>::type
|
||||
operator()(Seq const & s) const
|
||||
{
|
||||
return fusion::invoke<func_const_fwd_t>(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke<func_fwd_t,Seq const>::type
|
||||
operator()(Seq const & s)
|
||||
{
|
||||
return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke<func_const_fwd_t,Seq>::type
|
||||
operator()(Seq & s) const
|
||||
{
|
||||
return fusion::invoke<func_const_fwd_t>(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke<func_fwd_t,Seq>::type
|
||||
operator()(Seq & s)
|
||||
{
|
||||
return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self const (Seq) >
|
||||
: result_of::invoke<func_const_fwd_t,
|
||||
typename boost::remove_reference<Seq>::type >
|
||||
{ };
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq) >
|
||||
: result_of::invoke<func_fwd_t,
|
||||
typename boost::remove_reference<Seq>::type >
|
||||
{ };
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*=============================================================================
|
||||
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_FUSED_FUNCTION_OBJECT_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_FUNCTION_OBJECT_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke_function_object.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class fused_function_object;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function>
|
||||
class fused_function_object
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type & func_const_fwd_t;
|
||||
typedef typename detail::qf<Function>::type & func_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit fused_function_object(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_function_object<func_const_fwd_t,
|
||||
Seq const>::type operator()(Seq const & s) const
|
||||
{
|
||||
return fusion::invoke_function_object<
|
||||
func_const_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_function_object<func_fwd_t,
|
||||
Seq const>::type
|
||||
operator()(Seq const & s)
|
||||
{
|
||||
return fusion::invoke_function_object<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_function_object<func_const_fwd_t,
|
||||
Seq>::type
|
||||
operator()(Seq & s) const
|
||||
{
|
||||
return fusion::invoke_function_object<
|
||||
func_const_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_function_object<func_fwd_t,Seq>::type
|
||||
operator()(Seq & s)
|
||||
{
|
||||
return fusion::invoke_function_object<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self const (Seq) >
|
||||
: result_of::invoke_function_object<func_const_fwd_t,
|
||||
typename boost::remove_reference<Seq>::type >
|
||||
{ };
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq) >
|
||||
: result_of::invoke_function_object<func_fwd_t,
|
||||
typename boost::remove_reference<Seq>::type >
|
||||
{ };
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
70
include/boost/fusion/functional/adapter/fused_procedure.hpp
Normal file
70
include/boost/fusion/functional/adapter/fused_procedure.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*=============================================================================
|
||||
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_FUSED_PROCEDURE_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Function> class fused_procedure;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <typename Function>
|
||||
class fused_procedure
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type & func_const_fwd_t;
|
||||
typedef typename detail::qf<Function>::type & func_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit fused_procedure(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <class Seq>
|
||||
inline void operator()(Seq const & s) const
|
||||
{
|
||||
fusion::invoke_procedure<
|
||||
func_const_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline void operator()(Seq const & s)
|
||||
{
|
||||
fusion::invoke_procedure<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline void operator()(Seq & s) const
|
||||
{
|
||||
fusion::invoke_procedure<
|
||||
func_const_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline void operator()(Seq & s)
|
||||
{
|
||||
return fusion::invoke_procedure<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
typedef void result_type;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
39
include/boost/fusion/functional/adapter/limits.hpp
Normal file
39
include/boost/fusion/functional/adapter/limits.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
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_LIMITS_HPP_INCLUDED)
|
||||
# define BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED
|
||||
|
||||
# include <boost/fusion/container/vector/limits.hpp>
|
||||
|
||||
# if !defined(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY)
|
||||
# define BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY 6
|
||||
# elif BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
|
||||
# error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY)
|
||||
# define BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY 6
|
||||
# elif BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
|
||||
# error "BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY)
|
||||
# define BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY 6
|
||||
# elif BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
|
||||
# error "BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
|
||||
# define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6
|
||||
# elif BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
|
||||
# error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_CONSTRUCTOR_MAX_ARITY)
|
||||
# define BOOST_FUSION_CONSTRUCTOR_MAX_ARITY 6
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
175
include/boost/fusion/functional/adapter/unfused_generic.hpp
Normal file
175
include/boost/fusion/functional/adapter/unfused_generic.hpp
Normal file
@ -0,0 +1,175 @@
|
||||
/*=============================================================================
|
||||
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_UNFUSED_GENERIC_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class unfused_generic;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function>
|
||||
class unfused_generic
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_generic(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function_c(fusion::vector0 &) >::type call_const_0_result;
|
||||
|
||||
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 boost::result_of<function_c( \
|
||||
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 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); \
|
||||
return this->fnc_transformed(arg); \
|
||||
}
|
||||
|
||||
#define BOOST_PP_INDIRECT_SELF \
|
||||
<boost/fusion/functional/adapter/unfused_generic.hpp>
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/functional/adapter/detail/pow2_explode.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY)
|
||||
#define N BOOST_PP_ITERATION_1
|
||||
#include BOOST_PP_ITERATE()
|
||||
#undef N
|
||||
|
||||
#undef BOOST_FUSION_CODE
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_generic<F> const ()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_generic<F>::call_const_0_result type;
|
||||
};
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_generic<F>()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_generic<F>::call_0_result type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/pt_def.hpp>
|
||||
|
||||
#if BOOST_PP_SLOT_1() == 0
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result
|
||||
< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of<function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
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)) >
|
||||
: 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 boost::result_of<function_c(
|
||||
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)>
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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)>
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
#else
|
||||
BOOST_FUSION_CODE(BOOST_PP_ENUM_PARAMS(N,typename T),
|
||||
BOOST_PP_ENUM_PARAMS(N,PT), BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a),
|
||||
BOOST_PP_ENUM_PARAMS(N,a) )
|
||||
// ...generates uglier code but is faster - it caches ENUM_*
|
||||
#endif
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/pt_undef.hpp>
|
||||
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
136
include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp
Normal file
136
include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp
Normal file
@ -0,0 +1,136 @@
|
||||
/*=============================================================================
|
||||
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_UNFUSED_LVALUE_ARGS_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class unfused_lvalue_args;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function> class unfused_lvalue_args
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_lvalue_args(func_const_fwd_t f = function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function_c(fusion::vector0 &) >::type call_const_0_result;
|
||||
|
||||
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>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F>
|
||||
struct result_of< boost::fusion::unfused_lvalue_args<F> const () >
|
||||
{
|
||||
typedef typename boost::fusion::unfused_lvalue_args<F>::call_const_0_result type;
|
||||
};
|
||||
template<class F>
|
||||
struct result_of< boost::fusion::unfused_lvalue_args<F>() >
|
||||
{
|
||||
typedef typename boost::fusion::unfused_lvalue_args<F>::call_0_result type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
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)) >
|
||||
: boost::result_of< function(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function_c(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)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
137
include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp
Normal file
137
include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp
Normal file
@ -0,0 +1,137 @@
|
||||
/*=============================================================================
|
||||
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_UNFUSED_RVALUE_ARGS_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class unfused_rvalue_args;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function> class unfused_rvalue_args
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_rvalue_args(func_const_fwd_t f = function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function_c(fusion::vector0 &) >::type call_const_0_result;
|
||||
|
||||
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>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_rvalue_args<F> const ()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_rvalue_args<F>::call_const_0_result type;
|
||||
};
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_rvalue_args<F>()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_rvalue_args<F>::call_0_result type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
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)) >
|
||||
: boost::result_of< function(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function_c(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)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
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)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
155
include/boost/fusion/functional/adapter/unfused_typed.hpp
Normal file
155
include/boost/fusion/functional/adapter/unfused_typed.hpp
Normal file
@ -0,0 +1,155 @@
|
||||
/*=============================================================================
|
||||
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_UNFUSED_TYPED_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/container/vector/convert.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
|
||||
template <class Function, class Sequence> class unfused_typed;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Derived, class Function,
|
||||
class Sequence, long Arity>
|
||||
struct unfused_typed_impl;
|
||||
}
|
||||
|
||||
template <class Function, class Sequence>
|
||||
class unfused_typed
|
||||
: public detail::unfused_typed_impl
|
||||
< unfused_typed<Function,Sequence>, Function, Sequence,
|
||||
result_of::size<Sequence>::value >
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
template <class D, class F, class S, long A>
|
||||
friend struct detail::unfused_typed_impl;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_typed(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
};
|
||||
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/functional/adapter/unfused_typed.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F, class Seq>
|
||||
struct result_of< boost::fusion::unfused_typed<F,Seq> const () >
|
||||
: boost::fusion::unfused_typed<F,Seq>::template result<
|
||||
boost::fusion::unfused_typed<F,Seq> const () >
|
||||
{ };
|
||||
template<class F, class Seq>
|
||||
struct result_of< boost::fusion::unfused_typed<F,Seq>() >
|
||||
: boost::fusion::unfused_typed<F,Seq>::template result<
|
||||
boost::fusion::unfused_typed<F,Seq> () >
|
||||
{ };
|
||||
}
|
||||
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_TYPED_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <class Derived, class Function, class Sequence>
|
||||
struct unfused_typed_impl<Derived,Function,Sequence,N>
|
||||
{
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
|
||||
|
||||
public:
|
||||
|
||||
#define M(z,i,s) \
|
||||
typename call_param<typename result_of::value_at_c<s,i>::type>::type a##i
|
||||
|
||||
inline typename boost::result_of<
|
||||
function_c(arg_vector_t &) >::type
|
||||
operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const
|
||||
{
|
||||
#if N > 0
|
||||
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
#else
|
||||
arg_vector_t arg;
|
||||
#endif
|
||||
return static_cast<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
inline typename boost::result_of<
|
||||
function(arg_vector_t &) >::type
|
||||
operator()(BOOST_PP_ENUM(N,M,arg_vector_t))
|
||||
{
|
||||
#if N > 0
|
||||
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
#else
|
||||
arg_vector_t arg;
|
||||
#endif
|
||||
return static_cast<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#undef M
|
||||
|
||||
template <typename Sig> struct result { typedef void type; };
|
||||
|
||||
template <class Self BOOST_PP_ENUM_TRAILING_PARAMS(N,typename T)>
|
||||
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function_c(arg_vector_t &) >
|
||||
{ };
|
||||
|
||||
template <class Self BOOST_PP_ENUM_TRAILING_PARAMS(N,typename T)>
|
||||
struct result< Self (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function(arg_vector_t &) >
|
||||
{ };
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user