adds functional module

[SVN r36955]
This commit is contained in:
Tobias Schwinger
2007-02-15 22:41:45 +00:00
parent f975648eea
commit 0ea1bbb067
34 changed files with 2593 additions and 0 deletions

View File

@@ -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

View 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

View File

@@ -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