forked from boostorg/fusion
adds functional module
[SVN r36955]
This commit is contained in:
17
include/boost/fusion/functional.hpp
Normal file
17
include/boost/fusion/functional.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
/*=============================================================================
|
||||
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_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/invocation.hpp>
|
||||
#include <boost/fusion/functional/adapter.hpp>
|
||||
#include <boost/fusion/functional/generation.hpp>
|
||||
|
||||
#endif
|
||||
|
18
include/boost/fusion/functional/adapter.hpp
Normal file
18
include/boost/fusion/functional/adapter.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
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_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_HPP_INCLUDED
|
||||
#include <boost/fusion/functional/adapter/fused.hpp>
|
||||
#include <boost/fusion/functional/adapter/fused_procedure.hpp>
|
||||
#include <boost/fusion/functional/adapter/fused_function_object.hpp>
|
||||
#include <boost/fusion/functional/adapter/unfused_generic.hpp>
|
||||
#include <boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
|
||||
#include <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
|
||||
#include <boost/fusion/functional/adapter/unfused_typed.hpp>
|
||||
#endif
|
@ -0,0 +1,102 @@
|
||||
/*=============================================================================
|
||||
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
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*=============================================================================
|
||||
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_HAS_TYPE_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_HAS_TYPE_HPP_INCLUDED
|
||||
|
||||
#include <boost/mpl/aux_/has_type.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
// Actually it's a sin... But MSVC's weird interpretation of ADL makes
|
||||
// me do this - tosh.
|
||||
using boost::mpl::aux::has_type;
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
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/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/has_type.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>
|
||||
struct nullary_call_base
|
||||
{
|
||||
template <typename T> inline void operator()(T reserved::*) const { }
|
||||
protected:
|
||||
typedef boost::blank r0;
|
||||
};
|
||||
|
||||
template <class Derived, class Function>
|
||||
struct nullary_call_base<Derived,Function,true>
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<Function>::type function;
|
||||
protected:
|
||||
typedef typename function::template result<fusion::vector0> r0;
|
||||
public:
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
37
include/boost/fusion/functional/adapter/detail/access.hpp
Normal file
37
include/boost/fusion/functional/adapter/detail/access.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*=============================================================================
|
||||
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; };
|
||||
|
||||
// boost::result_of to Fusion PFO parameter
|
||||
template <typename T> struct r2fp { typedef T const type; };
|
||||
template <typename T> struct r2fp<T const> { typedef T const type; };
|
||||
template <typename T> struct r2fp<T &> { typedef T type; };
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,102 @@
|
||||
/*=============================================================================
|
||||
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
|
||||
|
21
include/boost/fusion/functional/adapter/detail/has_type.hpp
Normal file
21
include/boost/fusion/functional/adapter/detail/has_type.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
/*=============================================================================
|
||||
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_HAS_TYPE_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_HAS_TYPE_HPP_INCLUDED
|
||||
|
||||
#include <boost/mpl/aux_/has_type.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
// Actually it's a sin... But MSVC's weird interpretation of ADL makes
|
||||
// me do this - tosh.
|
||||
using boost::mpl::aux::has_type;
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
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/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/has_type.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>
|
||||
struct nullary_call_base
|
||||
{
|
||||
template <typename T> inline void operator()(T reserved::*) const { }
|
||||
protected:
|
||||
typedef boost::blank r0;
|
||||
};
|
||||
|
||||
template <class Derived, class Function>
|
||||
struct nullary_call_base<Derived,Function,true>
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<Function>::type function;
|
||||
protected:
|
||||
typedef typename function::template result<fusion::vector0> r0;
|
||||
public:
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
inline typename function::template result<fusion::vector0>::type
|
||||
operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return static_cast<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
117
include/boost/fusion/functional/adapter/detail/pow2_explode.hpp
Normal file
117
include/boost/fusion/functional/adapter/detail/pow2_explode.hpp
Normal file
@ -0,0 +1,117 @@
|
||||
/*=============================================================================
|
||||
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
|
||||
|
78
include/boost/fusion/functional/adapter/fused.hpp
Normal file
78
include/boost/fusion/functional/adapter/fused.hpp
Normal file
@ -0,0 +1,78 @@
|
||||
/*=============================================================================
|
||||
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/support/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 boost::add_reference<Function>::type func_fwd_t;
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit fused(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke<Function,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<Function,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<Function,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<Function,Seq>::type
|
||||
operator()(Seq & s)
|
||||
{
|
||||
return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
struct result
|
||||
: 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
|
||||
|
@ -0,0 +1,83 @@
|
||||
/*=============================================================================
|
||||
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/support/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 boost::add_reference<Function>::type func_fwd_t;
|
||||
typedef typename detail::call_param<Function>::type func_const_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<Function,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<Function,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<Function,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<Function,Seq>::type
|
||||
operator()(Seq & s)
|
||||
{
|
||||
return fusion::invoke_function_object<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
struct result
|
||||
: 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
|
||||
|
79
include/boost/fusion/functional/adapter/fused_procedure.hpp
Normal file
79
include/boost/fusion/functional/adapter/fused_procedure.hpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*=============================================================================
|
||||
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/support/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 boost::add_reference<Function>::type func_fwd_t;
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit fused_procedure(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_procedure<Function,Seq const>::type
|
||||
operator()(Seq const & s) const
|
||||
{
|
||||
return fusion::invoke_procedure<
|
||||
func_const_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_procedure<Function,Seq const>::type
|
||||
operator()(Seq const & s)
|
||||
{
|
||||
return fusion::invoke_procedure<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_procedure<Function,Seq>::type
|
||||
operator()(Seq & s) const
|
||||
{
|
||||
return fusion::invoke_procedure<
|
||||
func_const_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
inline typename result_of::invoke_procedure<Function,Seq>::type
|
||||
operator()(Seq & s)
|
||||
{
|
||||
return fusion::invoke_procedure<
|
||||
func_fwd_t >(this->fnc_transformed,s);
|
||||
}
|
||||
|
||||
template <class Seq>
|
||||
struct result
|
||||
: result_of::invoke_procedure<Function,Seq>
|
||||
{ };
|
||||
|
||||
typedef void result_type;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
36
include/boost/fusion/functional/adapter/limits.hpp
Normal file
36
include/boost/fusion/functional/adapter/limits.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
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/sequence/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
|
||||
|
||||
#endif
|
||||
|
163
include/boost/fusion/functional/adapter/unfused_generic.hpp
Normal file
163
include/boost/fusion/functional/adapter/unfused_generic.hpp
Normal file
@ -0,0 +1,163 @@
|
||||
/*=============================================================================
|
||||
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/arithmetic/sub.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/sequence/container/vector/vector.hpp>
|
||||
|
||||
#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
|
||||
{
|
||||
template <class Function> class unfused_generic;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
struct void_;
|
||||
|
||||
template <class Function> class unfused_generic
|
||||
: public detail::nullary_call_base<unfused_generic<Function>, Function>
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
template <class D, class F, bool E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_generic<Function>, Function > base;
|
||||
|
||||
typedef typename boost::remove_reference<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)
|
||||
{ }
|
||||
|
||||
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_
|
||||
>
|
||||
struct result;
|
||||
|
||||
template <class _>
|
||||
struct result<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT),_>
|
||||
: 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 \
|
||||
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 \
|
||||
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
|
||||
};
|
||||
}}
|
||||
|
||||
#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>
|
||||
|
||||
#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 <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
struct result
|
||||
#if N < BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY
|
||||
< BOOST_PP_ENUM_PARAMS(N,T),
|
||||
BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_PP_SUB(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,N),
|
||||
fusion::void_ BOOST_PP_INTERCEPT), _ >
|
||||
#endif
|
||||
: function::template result< BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_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<
|
||||
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 function::template result<
|
||||
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
|
||||
|
130
include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp
Normal file
130
include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp
Normal file
@ -0,0 +1,130 @@
|
||||
/*=============================================================================
|
||||
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/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector.hpp>
|
||||
|
||||
#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
|
||||
{
|
||||
template <class Function> class unfused_lvalue_args;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
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 E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_lvalue_args<Function>, Function > base;
|
||||
|
||||
typedef typename boost::remove_reference<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)
|
||||
{ }
|
||||
|
||||
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_ >
|
||||
struct result;
|
||||
|
||||
template <typename _>
|
||||
struct result<BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT ), _ >
|
||||
: base::r0
|
||||
{ };
|
||||
|
||||
#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()
|
||||
};
|
||||
}}
|
||||
|
||||
#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>
|
||||
|
||||
#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 <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
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)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::mref<T,>::type
|
||||
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
|
||||
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 function::template result<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
|
||||
|
131
include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp
Normal file
131
include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp
Normal file
@ -0,0 +1,131 @@
|
||||
/*=============================================================================
|
||||
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/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector.hpp>
|
||||
|
||||
#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
|
||||
{
|
||||
template <class Function> class unfused_rvalue_args;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
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 E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef detail::nullary_call_base<
|
||||
fusion::unfused_rvalue_args<Function>, Function > base;
|
||||
|
||||
typedef typename boost::remove_reference<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)
|
||||
{ }
|
||||
|
||||
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_ >
|
||||
struct result;
|
||||
|
||||
template <typename _>
|
||||
struct result<BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT),_>
|
||||
: base::r0
|
||||
{ };
|
||||
|
||||
#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()
|
||||
};
|
||||
}}
|
||||
|
||||
#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>
|
||||
|
||||
#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 <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)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::cref<T,>::type
|
||||
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
|
||||
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 function::template result<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
|
||||
|
200
include/boost/fusion/functional/adapter/unfused_typed.hpp
Normal file
200
include/boost/fusion/functional/adapter/unfused_typed.hpp
Normal file
@ -0,0 +1,200 @@
|
||||
/*=============================================================================
|
||||
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_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.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/sequence/container/vector/vector.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
#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>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
|
||||
template <class Function, class Sequence> class unfused_typed;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Derived, class Function, class Sequence,
|
||||
long Arity, bool EnableCallOp>
|
||||
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<
|
||||
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_reference<Function>::type, Sequence, Sequence
|
||||
>::type
|
||||
{
|
||||
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 E>
|
||||
friend struct detail::nullary_call_base;
|
||||
|
||||
typedef typename boost::remove_reference<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;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_typed(func_const_fwd_t f = Function())
|
||||
: 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_
|
||||
>
|
||||
struct result;
|
||||
|
||||
template <typename _>
|
||||
struct result<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,
|
||||
fusion::void_ BOOST_PP_INTERCEPT),_>
|
||||
: base::r0
|
||||
{ };
|
||||
};
|
||||
|
||||
#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()
|
||||
|
||||
}}
|
||||
|
||||
#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>
|
||||
|
||||
#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,true>
|
||||
: unfused_typed_next_base<Derived,Function,Sequence>::type
|
||||
{
|
||||
private:
|
||||
typedef typename unfused_typed_next_base<
|
||||
Derived,Function,Sequence>::type base;
|
||||
|
||||
// Notes:
|
||||
// - conversion to fusion::vector might not be perfect (there is
|
||||
// currently no "inrinsic converting ctor" that would allow us
|
||||
// to let the user choose the sequence implementation)
|
||||
// - value_at_c (instead of iteration) is OK because of conversion
|
||||
// to fusion::vector - we would need iteration for arbitrary
|
||||
// sequences
|
||||
typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
|
||||
public:
|
||||
|
||||
using base::operator();
|
||||
|
||||
typedef typename Function::
|
||||
template result<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
|
||||
operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const
|
||||
{
|
||||
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return static_cast<Derived const *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
inline typename Function::template result<arg_vector_t>::type
|
||||
operator()(BOOST_PP_ENUM(N,M,arg_vector_t))
|
||||
{
|
||||
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return static_cast<Derived *>(this)->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#undef M
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class Function, class Sequence>
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
|
||||
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
|
||||
: BOOST_PP_CAT(base::r,N)
|
||||
{ };
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
19
include/boost/fusion/functional/generation.hpp
Normal file
19
include/boost/fusion/functional/generation.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/generation/make_fused.hpp>
|
||||
#include <boost/fusion/functional/generation/make_fused_procedure.hpp>
|
||||
#include <boost/fusion/functional/generation/make_fused_function_object.hpp>
|
||||
#include <boost/fusion/functional/generation/make_unfused_generic.hpp>
|
||||
#include <boost/fusion/functional/generation/make_unfused_lvalue_args.hpp>
|
||||
#include <boost/fusion/functional/generation/make_unfused_rvalue_args.hpp>
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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.
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
|
||||
#if !defined(BOOST_FUSION_CLASS_TPL_NAME)
|
||||
# error "BOOST_FUSION_CLASS_TPL_NAME undefined"
|
||||
#endif
|
||||
|
||||
#define BOOST_FUSION_FUNC_NAME BOOST_PP_CAT(make_,BOOST_FUSION_CLASS_TPL_NAME)
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename F>
|
||||
struct BOOST_FUSION_FUNC_NAME
|
||||
{
|
||||
typedef fusion::BOOST_FUSION_CLASS_TPL_NAME<
|
||||
typename fusion::detail::as_fusion_element<F>::type > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline typename result_of::BOOST_FUSION_FUNC_NAME<F>::type
|
||||
BOOST_FUSION_FUNC_NAME(F const & f)
|
||||
{
|
||||
return typename result_of::BOOST_FUSION_FUNC_NAME<F>::type(f);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#undef BOOST_FUSION_CLASS_TPL_NAME
|
||||
#undef BOOST_FUSION_FUNC_NAME
|
||||
|
18
include/boost/fusion/functional/generation/make_fused.hpp
Normal file
18
include/boost/fusion/functional/generation/make_fused.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_MAKE_FUSED_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_FUSED_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/fused.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME fused
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_MAKE_FUSED_FUNCTION_OBJECT_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_FUSED_FUNCTION_OBJECT_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/fused_function_object.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME fused_function_object
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_MAKE_FUSED_PROCEDURE_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_FUSED_PROCEDURE_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/fused_procedure.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME fused_procedure
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_MAKE_UNFUSED_GENERIC_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_GENERIC_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_generic.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME unfused_generic
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_MAKE_UNFUSED_LVALUE_ARGS_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_LVALUE_ARGS_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME unfused_lvalue_args
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 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_GENERATION_MAKE_UNFUSED_RVALUE_ARGS_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME unfused_rvalue_args
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
16
include/boost/fusion/functional/invocation.hpp
Normal file
16
include/boost/fusion/functional/invocation.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
/*=============================================================================
|
||||
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_INVOCATION_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_INVOCATION_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/invocation/invoke.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke_function_object.hpp>
|
||||
|
||||
#endif
|
@ -0,0 +1,87 @@
|
||||
/*=============================================================================
|
||||
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_INVOCATION_DETAIL_THAT_PTR_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_INVOCATION_DETAIL_THAT_PTR_HPP_INCLUDED
|
||||
|
||||
#include <boost/get_pointer.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/type_traits/config.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Wanted>
|
||||
struct that_ptr
|
||||
{
|
||||
private:
|
||||
|
||||
typedef typename remove_reference<Wanted>::type pointee;
|
||||
|
||||
template <typename T>
|
||||
static inline pointee * do_get_pointer(T &, pointee * x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
template <typename T>
|
||||
static inline pointee * do_get_pointer(T & x, void const *)
|
||||
{
|
||||
return get_pointer(x);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
static inline pointee * get(pointee * x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline pointee * get(pointee & x)
|
||||
{
|
||||
return boost::addressof(x);
|
||||
}
|
||||
|
||||
template <typename T> static inline pointee * get(T & x)
|
||||
{
|
||||
return do_get_pointer(x, boost::addressof(x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PtrOrSmartPtr> struct non_const_pointee;
|
||||
|
||||
namespace adl_barrier
|
||||
{
|
||||
using boost::get_pointer;
|
||||
void const * BOOST_TT_DECL get_pointer(...); // fallback
|
||||
|
||||
template< typename T> char const_tester(T *);
|
||||
template< typename T> long const_tester(T const *);
|
||||
|
||||
template <typename Ptr>
|
||||
struct non_const_pointee_impl
|
||||
{
|
||||
static Ptr & what;
|
||||
|
||||
static bool const value =
|
||||
sizeof(const_tester(get_pointer(what))) == 1;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename PtrOrSmartPtr> struct non_const_pointee
|
||||
: adl_barrier::non_const_pointee_impl<
|
||||
typename remove_cv<
|
||||
typename remove_reference<PtrOrSmartPtr>::type >::type >
|
||||
{
|
||||
typedef non_const_pointee type;
|
||||
typedef bool value_type;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
332
include/boost/fusion/functional/invocation/invoke.hpp
Normal file
332
include/boost/fusion/functional/invocation/invoke.hpp
Normal file
@ -0,0 +1,332 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2006 João Abecasis
|
||||
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_INVOCATION_INVOKE_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
#include <boost/function_types/is_function.hpp>
|
||||
#include <boost/function_types/is_callable_builtin.hpp>
|
||||
#include <boost/function_types/is_member_function_pointer.hpp>
|
||||
#include <boost/function_types/result_type.hpp>
|
||||
#include <boost/function_types/parameter_types.hpp>
|
||||
#include <boost/function_types/function_arity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/front.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/functional/invocation/limits.hpp>
|
||||
#include <boost/fusion/functional/invocation/detail/that_ptr.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Function, class Sequence> struct invoke;
|
||||
}
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline typename result_of::invoke<Function, Sequence>::type
|
||||
invoke(Function, Sequence &);
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline typename result_of::invoke<Function, Sequence const>::type
|
||||
invoke(Function, Sequence const &);
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
namespace ft = function_types;
|
||||
|
||||
template<
|
||||
typename Function, class Sequence,
|
||||
int N = result_of::size<Sequence>::value,
|
||||
bool CBI = ft::is_callable_builtin<Function>::value,
|
||||
bool MFP = ft::is_member_function_pointer<Function>::value,
|
||||
bool RandomAccess = boost::is_convertible<
|
||||
typename traits::category_of<Sequence>::type,
|
||||
fusion::random_access_traversal_tag
|
||||
>::value
|
||||
>
|
||||
struct invoke_impl
|
||||
{
|
||||
typedef boost::blank result;
|
||||
};
|
||||
|
||||
template <class Sequence, int N> struct invoke_param_types;
|
||||
|
||||
template <typename Func, class N, bool CBI = true, typename Sig = void>
|
||||
// contains type member with the result, empty on error
|
||||
struct invoke_result
|
||||
: mpl::if_<
|
||||
mpl::or_<
|
||||
mpl::equal_to< ft::function_arity<Func>, N >,
|
||||
mpl::and_< ft::is_callable_builtin<Func, ft::variadic>,
|
||||
mpl::less< ft::function_arity<Func>, N > >
|
||||
>, ft::result_type<Func>, boost::blank
|
||||
>::type
|
||||
{ };
|
||||
template <typename Func, class N, typename Sig>
|
||||
struct invoke_result<Func,N,false,Sig>
|
||||
: boost::result_of<Sig>
|
||||
{ };
|
||||
|
||||
// Transform for F so that boost::result_of< F(...) > works
|
||||
template <typename F> struct invoke_result_of_prep
|
||||
: mpl::if_< ft::is_function<F>, boost::add_reference<F>,
|
||||
boost::remove_cv<F>
|
||||
>::type
|
||||
{ };
|
||||
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/functional/invocation/invoke.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (0, BOOST_FUSION_INVOKE_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
template <typename T, class C, class Sequence>
|
||||
struct invoke_data_member
|
||||
{
|
||||
private:
|
||||
|
||||
typedef typename result_of::front<Sequence>::type that;
|
||||
|
||||
typedef mpl::or_< is_convertible<that,C*>,
|
||||
is_convertible<that,C&>,
|
||||
non_const_pointee<that> > non_const_cond;
|
||||
|
||||
typedef typename mpl::eval_if< non_const_cond,
|
||||
mpl::identity<C>, add_const<C> >::type qualified_class;
|
||||
|
||||
typedef typename mpl::eval_if< non_const_cond,
|
||||
mpl::identity<T>, add_const<T> >::type qualified_type;
|
||||
|
||||
public:
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: boost::add_reference<qualified_type>
|
||||
{ };
|
||||
|
||||
static inline typename result<>::type call(T C::* f, Sequence & s)
|
||||
{
|
||||
typename result_of::front<Sequence>::type c = fusion::front(s);
|
||||
return that_ptr<qualified_class>::get(c)->*f;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, class C, class Sequence>
|
||||
struct invoke_impl<T C::*, Sequence, 1, true, false, false>
|
||||
: detail::invoke_data_member<T, C, Sequence>
|
||||
{ };
|
||||
|
||||
template <typename T, class C, class Sequence>
|
||||
struct invoke_impl<T C::*, Sequence, 1, true, false, true>
|
||||
: detail::invoke_data_member<T, C, Sequence>
|
||||
{ };
|
||||
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Function, class Sequence> struct invoke
|
||||
: detail::invoke_impl<
|
||||
typename boost::remove_reference<Function>::type, Sequence
|
||||
>::template result<>
|
||||
{ };
|
||||
}
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline typename result_of::invoke<Function,Sequence>::type
|
||||
invoke(Function f, Sequence & s)
|
||||
{
|
||||
return detail::invoke_impl<
|
||||
typename boost::remove_reference<Function>::type,Sequence
|
||||
>::call(f,s);
|
||||
}
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline typename result_of::invoke<Function,Sequence const>::type
|
||||
invoke(Function f, Sequence const & s)
|
||||
{
|
||||
return detail::invoke_impl<
|
||||
typename boost::remove_reference<Function>::type,Sequence const
|
||||
>::call(f,s);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_INVOCATION_INVOKE_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename Function, class Sequence, bool CBI>
|
||||
struct invoke_impl<Function,Sequence,N,CBI,false,true>
|
||||
{
|
||||
private:
|
||||
typedef typename invoke_result_of_prep<Function>::type func;
|
||||
public:
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: invoke_result< Function, mpl::size_t<N>, CBI,
|
||||
#define M(z,j,data) typename result_of::at_c<Sequence,j>::type
|
||||
func(BOOST_PP_ENUM(N,M,~)) >
|
||||
#undef M
|
||||
{ };
|
||||
|
||||
template <typename F>
|
||||
static inline typename result<F>::type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
#define M(z,j,data) fusion::at_c<j>(s)
|
||||
return f( BOOST_PP_ENUM(N,M,~) );
|
||||
}
|
||||
};
|
||||
|
||||
#if N > 0
|
||||
template <typename Function, class Sequence>
|
||||
struct invoke_impl<Function,Sequence,N,true,true,true>
|
||||
{
|
||||
public:
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: invoke_result< Function, mpl::size_t<N> >
|
||||
{ };
|
||||
|
||||
template <typename F>
|
||||
static inline typename result<F>::type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
return (that_ptr<typename mpl::front<
|
||||
ft::parameter_types<Function> >::type
|
||||
>::get(fusion::at_c<0>(s))->*f)(BOOST_PP_ENUM_SHIFTED(N,M,~));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef M
|
||||
|
||||
#define M(z,j,data) \
|
||||
typename seq::I##j i##j = \
|
||||
fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(j)));
|
||||
|
||||
template <typename Function, class Sequence, bool CBI>
|
||||
struct invoke_impl<Function,Sequence,N,CBI,false,false>
|
||||
{
|
||||
private:
|
||||
typedef typename invoke_result_of_prep<Function>::type func;
|
||||
typedef invoke_param_types<Sequence,N> seq;
|
||||
public:
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: invoke_result< Function, mpl::size_t<N>, CBI,
|
||||
func(BOOST_PP_ENUM_PARAMS(N,typename seq::T)) >
|
||||
{ };
|
||||
|
||||
template <typename F>
|
||||
static inline typename result<F>::type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
#if N > 0
|
||||
typename seq::I0 i0 = fusion::begin(s);
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
#endif
|
||||
return f( BOOST_PP_ENUM_PARAMS(N,*i) );
|
||||
}
|
||||
};
|
||||
|
||||
#if N > 0
|
||||
template <typename Function, class Sequence>
|
||||
struct invoke_impl<Function,Sequence,N,true,true,false>
|
||||
{
|
||||
private:
|
||||
typedef invoke_param_types<Sequence,N> seq;
|
||||
public:
|
||||
|
||||
template <typename _ = void>
|
||||
struct result
|
||||
: invoke_result< Function, mpl::size_t<N> >
|
||||
{ };
|
||||
|
||||
template <typename F>
|
||||
static inline typename result<F>::type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
typename seq::I0 i0 = fusion::begin(s);
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
|
||||
return (that_ptr< typename mpl::front<
|
||||
ft::parameter_types<Function> >::type
|
||||
>::get(*i0)->*f)(BOOST_PP_ENUM_SHIFTED_PARAMS(N,*i));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef M
|
||||
|
||||
template <class Sequence> struct invoke_param_types<Sequence,N>
|
||||
{
|
||||
#if N > 0
|
||||
typedef typename result_of::begin<Sequence>::type I0;
|
||||
typedef typename result_of::deref<I0>::type T0;
|
||||
|
||||
#define M(z,i,data) \
|
||||
typedef typename result_of::next< \
|
||||
BOOST_PP_CAT(I,BOOST_PP_DEC(i))>::type I##i; \
|
||||
typedef typename result_of::deref<I##i>::type T##i;
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
#undef M
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
@ -0,0 +1,190 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2006 João Abecasis
|
||||
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_INVOCATION_INVOKE_FUNCTION_OBJECT_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/functional/invocation/limits.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <class Function, class Sequence> struct invoke_function_object;
|
||||
}
|
||||
|
||||
template <class Function, class Sequence>
|
||||
inline typename result_of::invoke_function_object<Function, Sequence>::type
|
||||
invoke_function_object(Function, Sequence &);
|
||||
|
||||
template <class Function, class Sequence>
|
||||
inline typename result_of::invoke_function_object<Function, Sequence const
|
||||
>::type invoke_function_object(Function, Sequence const &);
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<
|
||||
class Function, class Sequence,
|
||||
int N = result_of::size<Sequence>::value,
|
||||
bool RandomAccess = boost::is_convertible<
|
||||
typename traits::category_of<Sequence>::type,
|
||||
fusion::random_access_traversal_tag
|
||||
>::value
|
||||
>
|
||||
struct invoke_function_object_impl
|
||||
{
|
||||
typedef boost::blank result;
|
||||
};
|
||||
|
||||
template <class Sequence, int N>
|
||||
struct invoke_function_object_param_types;
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/functional/invocation/invoke_function_object.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(0, BOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <class Function, class Sequence> struct invoke_function_object
|
||||
: detail::invoke_function_object_impl<
|
||||
typename boost::remove_reference<Function>::type, Sequence
|
||||
>::template result<>
|
||||
{ };
|
||||
}
|
||||
|
||||
template <class Function, class Sequence>
|
||||
inline typename result_of::invoke_function_object<Function,Sequence>::type
|
||||
invoke_function_object(Function f, Sequence & s)
|
||||
{
|
||||
return detail::invoke_function_object_impl<
|
||||
typename boost::remove_reference<Function>::type,Sequence
|
||||
>::call(f,s);
|
||||
}
|
||||
|
||||
template <class Function, class Sequence>
|
||||
inline typename result_of::invoke_function_object<Function,Sequence const>::type
|
||||
invoke_function_object(Function f, Sequence const & s)
|
||||
{
|
||||
return detail::invoke_function_object_impl<
|
||||
typename boost::remove_reference<Function>::type,Sequence const
|
||||
>::call(f,s);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_INVOCATION_INVOKE_FUNCTION_OBJECT_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <class Function, class Sequence>
|
||||
struct invoke_function_object_impl<Function,Sequence,N,true>
|
||||
{
|
||||
public:
|
||||
|
||||
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,~) >
|
||||
#undef M
|
||||
{ };
|
||||
|
||||
template <class F>
|
||||
static inline typename result<F>::type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
#define M(z,j,data) fusion::at_c<j>(s)
|
||||
return f( BOOST_PP_ENUM(N,M,~) );
|
||||
#undef M
|
||||
}
|
||||
};
|
||||
|
||||
template <class Function, class Sequence>
|
||||
struct invoke_function_object_impl<Function,Sequence,N,false>
|
||||
{
|
||||
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) >
|
||||
{ };
|
||||
|
||||
template <class F>
|
||||
static inline typename result<F>::type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
#if N > 0
|
||||
typename seq::I0 i0 = fusion::begin(s);
|
||||
#define M(z,j,data) \
|
||||
typename seq::I##j i##j = \
|
||||
fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(j)));
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
#undef M
|
||||
#endif
|
||||
return f( BOOST_PP_ENUM_PARAMS(N,*i) );
|
||||
}
|
||||
};
|
||||
|
||||
template <class Sequence>
|
||||
struct invoke_function_object_param_types<Sequence,N>
|
||||
{
|
||||
#if N > 0
|
||||
typedef typename result_of::begin<Sequence>::type I0;
|
||||
typedef typename boost::remove_reference<
|
||||
typename result_of::value_of<I0>::type >::type T0;
|
||||
|
||||
#define M(z,i,data) \
|
||||
typedef typename result_of::next< \
|
||||
BOOST_PP_CAT(I,BOOST_PP_DEC(i))>::type I##i; \
|
||||
typedef typename boost::remove_reference< \
|
||||
typename result_of::value_of<I##i>::type >::type T##i;
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
#undef M
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
225
include/boost/fusion/functional/invocation/invoke_procedure.hpp
Normal file
225
include/boost/fusion/functional/invocation/invoke_procedure.hpp
Normal file
@ -0,0 +1,225 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2006 João Abecasis
|
||||
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_INVOCATION_INVOKE_PROCEDURE_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/function_types/is_callable_builtin.hpp>
|
||||
#include <boost/function_types/is_member_function_pointer.hpp>
|
||||
#include <boost/function_types/parameter_types.hpp>
|
||||
#include <boost/function_types/function_arity.hpp>
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/functional/invocation/limits.hpp>
|
||||
#include <boost/fusion/functional/invocation/detail/that_ptr.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Function, class Sequence> struct invoke_procedure;
|
||||
}
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline void invoke_procedure(Function, Sequence &);
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline void invoke_procedure(Function, Sequence const &);
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
namespace ft = function_types;
|
||||
|
||||
template<
|
||||
typename Function, class Sequence,
|
||||
int N = result_of::size<Sequence>::value,
|
||||
bool CBI = ft::is_callable_builtin<Function>::value,
|
||||
bool MFP = ft::is_member_function_pointer<Function>::value,
|
||||
bool RandomAccess = boost::is_convertible<
|
||||
typename traits::category_of<Sequence>::type,
|
||||
fusion::random_access_traversal_tag
|
||||
>::value
|
||||
>
|
||||
struct invoke_procedure_impl
|
||||
{
|
||||
typedef boost::blank result;
|
||||
};
|
||||
|
||||
template <typename Func, class N, bool CBI = true>
|
||||
// Contains void type member, empty on arity mismatch
|
||||
struct invoke_procedure_result
|
||||
: mpl::if_<
|
||||
mpl::or_<
|
||||
mpl::bool_<! CBI>,
|
||||
mpl::equal_to< ft::function_arity<Func>, N >,
|
||||
mpl::and_< ft::is_callable_builtin<Func, ft::variadic>,
|
||||
mpl::less< ft::function_arity<Func>, N > >
|
||||
>, mpl::identity<void>, boost::blank
|
||||
>::type
|
||||
{ };
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/functional/invocation/invoke_procedure.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(0, BOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Function, class Sequence> struct invoke_procedure
|
||||
: detail::invoke_procedure_impl<
|
||||
typename boost::remove_reference<Function>::type, Sequence
|
||||
>::result
|
||||
{ };
|
||||
}
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline void invoke_procedure(Function f, Sequence & s)
|
||||
{
|
||||
detail::invoke_procedure_impl<
|
||||
typename boost::remove_reference<Function>::type,Sequence
|
||||
>::call(f,s);
|
||||
}
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
inline void invoke_procedure(Function f, Sequence const & s)
|
||||
{
|
||||
detail::invoke_procedure_impl<
|
||||
typename boost::remove_reference<Function>::type,Sequence const
|
||||
>::call(f,s);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_INVOCATION_INVOKE_PROCEDURE_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
#define M(z,j,data) fusion::at_c<j>(s)
|
||||
|
||||
template <typename Function, class Sequence, bool CBI>
|
||||
struct invoke_procedure_impl<Function,Sequence,N,CBI,false,true>
|
||||
{
|
||||
struct result
|
||||
: invoke_procedure_result< Function, mpl::size_t<N>, CBI >
|
||||
{ };
|
||||
|
||||
static inline void call(Function & f, Sequence & s)
|
||||
{
|
||||
f(BOOST_PP_ENUM(N,M,~));
|
||||
}
|
||||
};
|
||||
|
||||
#if N > 0
|
||||
template <typename Function, class Sequence>
|
||||
struct invoke_procedure_impl<Function,Sequence,N,true,true,true>
|
||||
{
|
||||
struct result
|
||||
: invoke_procedure_result< Function, mpl::size_t<N> >
|
||||
{ };
|
||||
|
||||
static inline void call(Function & f, Sequence & s)
|
||||
{
|
||||
(that_ptr<typename mpl::front<
|
||||
ft::parameter_types<Function> >::type
|
||||
>::get(fusion::at_c<0>(s))->*f)(BOOST_PP_ENUM_SHIFTED(N,M,~));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef M
|
||||
|
||||
#define M(z,j,data) \
|
||||
typedef typename result_of::next< BOOST_PP_CAT(I,BOOST_PP_DEC(j)) \
|
||||
>::type I ## j ; \
|
||||
I##j i##j = fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(j)));
|
||||
|
||||
template <typename Function, class Sequence, bool CBI>
|
||||
struct invoke_procedure_impl<Function,Sequence,N,CBI,false,false>
|
||||
{
|
||||
struct result
|
||||
: invoke_procedure_result< Function, mpl::size_t<N>, CBI >
|
||||
{ };
|
||||
|
||||
static inline void call(Function & f, Sequence & s)
|
||||
{
|
||||
#if N > 0
|
||||
typedef typename result_of::begin<Sequence>::type I0;
|
||||
I0 i0 = fusion::begin(s);
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
#endif
|
||||
f( BOOST_PP_ENUM_PARAMS(N,*i) );
|
||||
}
|
||||
};
|
||||
|
||||
#if N > 0
|
||||
template <typename Function, class Sequence>
|
||||
struct invoke_procedure_impl<Function,Sequence,N,true,true,false>
|
||||
{
|
||||
struct result
|
||||
: invoke_procedure_result< Function, mpl::size_t<N> >
|
||||
{ };
|
||||
|
||||
static inline void call(Function & f, Sequence & s)
|
||||
{
|
||||
typedef typename result_of::begin<Sequence>::type I0;
|
||||
I0 i0 = fusion::begin(s);
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
|
||||
(that_ptr<typename mpl::front<
|
||||
ft::parameter_types<Function> >::type
|
||||
>::get(*i0)->*f)(BOOST_PP_ENUM_SHIFTED_PARAMS(N,*i));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef M
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
23
include/boost/fusion/functional/invocation/limits.hpp
Normal file
23
include/boost/fusion/functional/invocation/limits.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).
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_FUSION_FUNCTIONAL_INVOCATION_LIMITS_HPP_INCLUDED)
|
||||
# define BOOST_FUSION_FUNCTIONAL_INVOCATION_LIMITS_HPP_INCLUDED
|
||||
|
||||
# if !defined(BOOST_FUSION_INVOKE_MAX_ARITY)
|
||||
# define BOOST_FUSION_INVOKE_MAX_ARITY 6
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY)
|
||||
# define BOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY 6
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY)
|
||||
# define BOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY 6
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user