stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,359 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file arg.hpp
|
||||
/// Contains definition of the argN transforms.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_ARG_HPP_EAN_11_01_2007
|
||||
#define BOOST_PROTO_TRANSFORM_ARG_HPP_EAN_11_01_2007
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/proto/transform/env.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
|
||||
/// \brief A PrimitiveTransform that returns the current expression
|
||||
/// unmodified
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// proto::terminal<int>::type & j = proto::_expr()(i);
|
||||
/// assert( boost::addressof(i) == boost::addressof(j) );
|
||||
/// \endcode
|
||||
struct _expr : transform<_expr>
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef Expr result_type;
|
||||
|
||||
/// Returns the current expression.
|
||||
/// \param e The current expression.
|
||||
/// \return \c e
|
||||
/// \throw nothrow
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
|
||||
operator()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return e;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns the current state
|
||||
/// unmodified
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// char ch = proto::_state()(i, 'a');
|
||||
/// assert( ch == 'a' );
|
||||
/// \endcode
|
||||
struct _state : transform<_state>
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef State result_type;
|
||||
|
||||
/// Returns the current state.
|
||||
/// \param s The current state.
|
||||
/// \return \c s
|
||||
/// \throw nothrow
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::state_param)
|
||||
operator ()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return s;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns the current data
|
||||
/// unmodified
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// std::string str("hello");
|
||||
/// std::string & data = proto::_data()(i, 'a', str);
|
||||
/// assert( &str == &data );
|
||||
/// \endcode
|
||||
struct _data : transform<_data>
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: mpl::if_c<
|
||||
is_env<Data>::value
|
||||
, _env_var<data_type>
|
||||
, _env
|
||||
>::type::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns N-th child of the current
|
||||
/// expression.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// proto::terminal<int>::type & j = proto::_child_c<0>()(-i);
|
||||
/// assert( boost::addressof(i) == boost::addressof(j) );
|
||||
/// \endcode
|
||||
template<int N>
|
||||
struct _child_c : transform<_child_c<N> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename result_of::child_c<Expr, N>::type
|
||||
result_type;
|
||||
|
||||
/// Returns the N-th child of \c e
|
||||
/// \pre <tt>arity_of\<Expr\>::value \> N</tt>
|
||||
/// \param e The current expression.
|
||||
/// \return <tt>proto::child_c\<N\>(e)</tt>
|
||||
/// \throw nothrow
|
||||
#ifdef BOOST_PROTO_STRICT_RESULT_OF
|
||||
result_type
|
||||
#else
|
||||
typename result_of::child_c<typename impl::expr_param, N>::type
|
||||
#endif
|
||||
operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return proto::child_c<N>(e);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns the value of the
|
||||
/// current terminal expression.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// int j = proto::_value()(i);
|
||||
/// assert( 42 == j );
|
||||
/// \endcode
|
||||
struct _value : transform<_value>
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename result_of::value<Expr>::type
|
||||
result_type;
|
||||
|
||||
/// Returns the value of the specified terminal expression.
|
||||
/// \pre <tt>arity_of\<Expr\>::value == 0</tt>.
|
||||
/// \param e The current expression.
|
||||
/// \return <tt>proto::value(e)</tt>
|
||||
/// \throw nothrow
|
||||
#ifdef BOOST_PROTO_STRICT_RESULT_OF
|
||||
typename mpl::if_c<is_array<result_type>::value, result_type &, result_type>::type
|
||||
#else
|
||||
typename result_of::value<typename impl::expr_param>::type
|
||||
#endif
|
||||
operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return proto::value(e);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that does nothing
|
||||
/// and returns void.
|
||||
struct _void : transform<_void>
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
/// Does nothing and returns void
|
||||
void operator ()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A unary CallableTransform that wraps its argument
|
||||
/// in a \c boost::reference_wrapper\<\>.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// boost::reference_wrapper<proto::terminal<int>::type> j
|
||||
/// = proto::when<_, proto::_byref(_)>()(i);
|
||||
/// assert( boost::addressof(i) == boost::addressof(j.get()) );
|
||||
/// \endcode
|
||||
struct _byref : callable
|
||||
{
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename T>
|
||||
struct result<This(T)>
|
||||
{
|
||||
typedef boost::reference_wrapper<T const> const type;
|
||||
};
|
||||
|
||||
template<typename This, typename T>
|
||||
struct result<This(T &)>
|
||||
{
|
||||
typedef boost::reference_wrapper<T> const type;
|
||||
};
|
||||
|
||||
/// Wrap the parameter \c t in a \c boost::reference_wrapper\<\>
|
||||
/// \param t The object to wrap
|
||||
/// \return <tt>boost::ref(t)</tt>
|
||||
/// \throw nothrow
|
||||
template<typename T>
|
||||
boost::reference_wrapper<T> const operator ()(T &t) const
|
||||
{
|
||||
return boost::reference_wrapper<T>(t);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
///
|
||||
template<typename T>
|
||||
boost::reference_wrapper<T const> const operator ()(T const &t) const
|
||||
{
|
||||
return boost::reference_wrapper<T const>(t);
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief A unary CallableTransform that strips references
|
||||
/// and \c boost::reference_wrapper\<\> from its argument.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// \code
|
||||
/// proto::terminal<int>::type i = {42};
|
||||
/// int j = 67;
|
||||
/// int k = proto::when<_, proto::_byval(proto::_state)>()(i, boost::ref(j));
|
||||
/// assert( 67 == k );
|
||||
/// \endcode
|
||||
struct _byval : callable
|
||||
{
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename T>
|
||||
struct result<This(T)>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename This, typename T>
|
||||
struct result<This(T &)>
|
||||
: result<This(T)>
|
||||
{};
|
||||
|
||||
template<typename This, typename T>
|
||||
struct result<This(boost::reference_wrapper<T>)>
|
||||
: result<This(T)>
|
||||
{};
|
||||
|
||||
/// \param t The object to unref
|
||||
/// \return <tt>t</tt>
|
||||
/// \throw nothrow
|
||||
template<typename T>
|
||||
T operator ()(T const &t) const
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
/// \overload
|
||||
///
|
||||
template<typename T>
|
||||
T operator ()(boost::reference_wrapper<T> const &t) const
|
||||
{
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<>
|
||||
struct is_callable<_expr>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<>
|
||||
struct is_callable<_state>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<>
|
||||
struct is_callable<_data>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<int N>
|
||||
struct is_callable<_child_c<N> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<>
|
||||
struct is_callable<_value>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<>
|
||||
struct is_callable<_byref>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<>
|
||||
struct is_callable<_byval>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,401 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file call.hpp
|
||||
/// Contains definition of the call<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
|
||||
#define BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.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/ref.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/detail/as_lvalue.hpp>
|
||||
#include <boost/proto/detail/poly_function.hpp>
|
||||
#include <boost/proto/transform/detail/pack.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
/// \brief Wrap \c PrimitiveTransform so that <tt>when\<\></tt> knows
|
||||
/// it is callable. Requires that the parameter is actually a
|
||||
/// PrimitiveTransform.
|
||||
///
|
||||
/// This form of <tt>call\<\></tt> is useful for annotating an
|
||||
/// arbitrary PrimitiveTransform as callable when using it with
|
||||
/// <tt>when\<\></tt>. Consider the following transform, which
|
||||
/// is parameterized with another transform.
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Grammar>
|
||||
/// struct Foo
|
||||
/// : when<
|
||||
/// unary_plus<Grammar>
|
||||
/// , Grammar(_child) // May or may not work.
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// The problem with the above is that <tt>when\<\></tt> may or
|
||||
/// may not recognize \c Grammar as callable, depending on how
|
||||
/// \c Grammar is implemented. (See <tt>is_callable\<\></tt> for
|
||||
/// a discussion of this issue.) You can guard against
|
||||
/// the issue by wrapping \c Grammar in <tt>call\<\></tt>, such
|
||||
/// as:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Grammar>
|
||||
/// struct Foo
|
||||
/// : when<
|
||||
/// unary_plus<Grammar>
|
||||
/// , call<Grammar>(_child) // OK, this works
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// The above could also have been written as:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Grammar>
|
||||
/// struct Foo
|
||||
/// : when<
|
||||
/// unary_plus<Grammar>
|
||||
/// , call<Grammar(_child)> // OK, this works, too
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
template<typename PrimitiveTransform>
|
||||
struct call
|
||||
: PrimitiveTransform
|
||||
{};
|
||||
|
||||
/// \brief A specialization that treats function pointer Transforms as
|
||||
/// if they were function type Transforms.
|
||||
///
|
||||
/// This specialization requires that \c Fun is actually a function type.
|
||||
///
|
||||
/// This specialization is required for nested transforms such as
|
||||
/// <tt>call\<T0(T1(_))\></tt>. In C++, functions that are used as
|
||||
/// parameters to other functions automatically decay to funtion
|
||||
/// pointer types. In other words, the type <tt>T0(T1(_))</tt> is
|
||||
/// indistinguishable from <tt>T0(T1(*)(_))</tt>. This specialization
|
||||
/// is required to handle these nested function pointer type transforms
|
||||
/// properly.
|
||||
template<typename Fun>
|
||||
struct call<Fun *>
|
||||
: call<Fun>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Fun>
|
||||
struct call<detail::msvc_fun_workaround<Fun> >
|
||||
: call<Fun>
|
||||
{};
|
||||
|
||||
/// \brief Either call the PolymorphicFunctionObject with 0
|
||||
/// arguments, or invoke the PrimitiveTransform with 3
|
||||
/// arguments.
|
||||
template<typename Fun>
|
||||
struct call<Fun()> : transform<call<Fun()> >
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr, typename State, typename Data, bool B>
|
||||
struct impl2
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename BOOST_PROTO_RESULT_OF<Fun()>::type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator()(
|
||||
typename impl2::expr_param
|
||||
, typename impl2::state_param
|
||||
, typename impl2::data_param
|
||||
) const
|
||||
{
|
||||
return Fun()();
|
||||
}
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl2<Expr, State, Data, true>
|
||||
: Fun::template impl<Expr, State, Data>
|
||||
{};
|
||||
|
||||
/// Either call the PolymorphicFunctionObject \c Fun with 0 arguments; or
|
||||
/// invoke the PrimitiveTransform \c Fun with 3 arguments: the current
|
||||
/// expression, state, and data.
|
||||
///
|
||||
/// If \c Fun is a nullary PolymorphicFunctionObject, return <tt>Fun()()</tt>.
|
||||
/// Otherwise, return <tt>Fun()(e, s, d)</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
|
||||
/// If \c Fun is a nullary PolymorphicFunctionObject, \c type is a typedef
|
||||
/// for <tt>boost::result_of\<Fun()\>::type</tt>. Otherwise, it is
|
||||
/// a typedef for <tt>boost::result_of\<Fun(Expr, State, Data)\>::type</tt>.
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief Either call the PolymorphicFunctionObject with 1
|
||||
/// argument, or invoke the PrimitiveTransform with 3
|
||||
/// arguments.
|
||||
template<typename Fun, typename A0>
|
||||
struct call<Fun(A0)> : transform<call<Fun(A0)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data, bool B>
|
||||
struct impl2
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
|
||||
typedef typename detail::poly_function_traits<Fun, Fun(a0)>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl2::expr_param e
|
||||
, typename impl2::state_param s
|
||||
, typename impl2::data_param d
|
||||
) const
|
||||
{
|
||||
return typename detail::poly_function_traits<Fun, Fun(a0)>::function_type()(
|
||||
detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl2<Expr, State, Data, true>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
|
||||
typedef typename Fun::template impl<a0, State, Data>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl2::expr_param e
|
||||
, typename impl2::state_param s
|
||||
, typename impl2::data_param d
|
||||
) const
|
||||
{
|
||||
return typename Fun::template impl<a0, State, Data>()(
|
||||
typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, s
|
||||
, d
|
||||
);
|
||||
}
|
||||
};
|
||||
/// Let \c x be <tt>when\<_, A0\>()(e, s, d)</tt> and \c X
|
||||
/// be the type of \c x.
|
||||
/// If \c Fun is a unary PolymorphicFunctionObject that accepts \c x,
|
||||
/// then \c type is a typedef for <tt>boost::result_of\<Fun(X)\>::type</tt>.
|
||||
/// Otherwise, it is a typedef for <tt>boost::result_of\<Fun(X, State, Data)\>::type</tt>.
|
||||
|
||||
/// Either call the PolymorphicFunctionObject with 1 argument:
|
||||
/// the result of applying the \c A0 transform; or
|
||||
/// invoke the PrimitiveTransform with 3 arguments:
|
||||
/// result of applying the \c A0 transform, the state, and the
|
||||
/// data.
|
||||
///
|
||||
/// Let \c x be <tt>when\<_, A0\>()(e, s, d)</tt>.
|
||||
/// If \c Fun is a unary PolymorphicFunctionObject that accepts \c x,
|
||||
/// then return <tt>Fun()(x)</tt>. Otherwise, return
|
||||
/// <tt>Fun()(x, s, d)</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief Either call the PolymorphicFunctionObject with 2
|
||||
/// arguments, or invoke the PrimitiveTransform with 3
|
||||
/// arguments.
|
||||
template<typename Fun, typename A0, typename A1>
|
||||
struct call<Fun(A0, A1)> : transform<call<Fun(A0, A1)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data, bool B>
|
||||
struct impl2
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
|
||||
typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
|
||||
typedef typename detail::poly_function_traits<Fun, Fun(a0, a1)>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl2::expr_param e
|
||||
, typename impl2::state_param s
|
||||
, typename impl2::data_param d
|
||||
) const
|
||||
{
|
||||
return typename detail::poly_function_traits<Fun, Fun(a0, a1)>::function_type()(
|
||||
detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d))
|
||||
, detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl2<Expr, State, Data, true>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
|
||||
typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
|
||||
typedef typename Fun::template impl<a0, a1, Data>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl2::expr_param e
|
||||
, typename impl2::state_param s
|
||||
, typename impl2::data_param d
|
||||
) const
|
||||
{
|
||||
return typename Fun::template impl<a0, a1, Data>()(
|
||||
typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, d
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/// Let \c x be <tt>when\<_, A0\>()(e, s, d)</tt> and \c X
|
||||
/// be the type of \c x.
|
||||
/// Let \c y be <tt>when\<_, A1\>()(e, s, d)</tt> and \c Y
|
||||
/// be the type of \c y.
|
||||
/// If \c Fun is a binary PolymorphicFunction object that accepts \c x
|
||||
/// and \c y, then \c type is a typedef for
|
||||
/// <tt>boost::result_of\<Fun(X, Y)\>::type</tt>. Otherwise, it is
|
||||
/// a typedef for <tt>boost::result_of\<Fun(X, Y, Data)\>::type</tt>.
|
||||
|
||||
/// Either call the PolymorphicFunctionObject with 2 arguments:
|
||||
/// the result of applying the \c A0 transform, and the
|
||||
/// result of applying the \c A1 transform; or invoke the
|
||||
/// PrimitiveTransform with 3 arguments: the result of applying
|
||||
/// the \c A0 transform, the result of applying the \c A1
|
||||
/// transform, and the data.
|
||||
///
|
||||
/// Let \c x be <tt>when\<_, A0\>()(e, s, d)</tt>.
|
||||
/// Let \c y be <tt>when\<_, A1\>()(e, s, d)</tt>.
|
||||
/// If \c Fun is a binary PolymorphicFunction object that accepts \c x
|
||||
/// and \c y, return <tt>Fun()(x, y)</tt>. Otherwise, return
|
||||
/// <tt>Fun()(x, y, d)</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief Call the PolymorphicFunctionObject or the
|
||||
/// PrimitiveTransform with the current expression, state
|
||||
/// and data, transformed according to \c A0, \c A1, and
|
||||
/// \c A2, respectively.
|
||||
template<typename Fun, typename A0, typename A1, typename A2>
|
||||
struct call<Fun(A0, A1, A2)> : transform<call<Fun(A0, A1, A2)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data, bool B>
|
||||
struct impl2
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
|
||||
typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
|
||||
typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;
|
||||
typedef typename detail::poly_function_traits<Fun, Fun(a0, a1, a2)>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl2::expr_param e
|
||||
, typename impl2::state_param s
|
||||
, typename impl2::data_param d
|
||||
) const
|
||||
{
|
||||
return typename detail::poly_function_traits<Fun, Fun(a0, a1, a2)>::function_type()(
|
||||
detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d))
|
||||
, detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d))
|
||||
, detail::as_lvalue(typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl2<Expr, State, Data, true>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
|
||||
typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
|
||||
typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;
|
||||
typedef typename Fun::template impl<a0, a1, a2>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl2::expr_param e
|
||||
, typename impl2::state_param s
|
||||
, typename impl2::data_param d
|
||||
) const
|
||||
{
|
||||
return typename Fun::template impl<a0, a1, a2>()(
|
||||
typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/// Let \c x be <tt>when\<_, A0\>()(e, s, d)</tt>.
|
||||
/// Let \c y be <tt>when\<_, A1\>()(e, s, d)</tt>.
|
||||
/// Let \c z be <tt>when\<_, A2\>()(e, s, d)</tt>.
|
||||
/// Return <tt>Fun()(x, y, z)</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
|
||||
{};
|
||||
};
|
||||
|
||||
#include <boost/proto/transform/detail/call.hpp>
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Fun>
|
||||
struct is_callable<call<Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}} // namespace boost::proto
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,598 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file default.hpp
|
||||
/// Contains definition of the _default transform, which gives operators their
|
||||
/// usual C++ meanings and uses Boost.Typeof to deduce return types.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_DEFAULT_HPP_EAN_04_04_2008
|
||||
#define BOOST_PROTO_TRANSFORM_DEFAULT_HPP_EAN_04_04_2008
|
||||
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/get_pointer.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_member_pointer.hpp>
|
||||
#include <boost/type_traits/is_member_object_pointer.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/arg.hpp>
|
||||
#include <boost/proto/detail/decltype.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Grammar, typename Tag>
|
||||
struct default_case
|
||||
: not_<_>
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::terminal>
|
||||
: when<terminal<_>, _value>
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_cases
|
||||
{
|
||||
template<typename Tag>
|
||||
struct case_
|
||||
: default_case<Grammar, Tag>
|
||||
{};
|
||||
};
|
||||
|
||||
#define BOOST_PROTO_UNARY_DEFAULT_EVAL(OP, TAG, MAKE) \
|
||||
template<typename Grammar> \
|
||||
struct BOOST_PP_CAT(default_, TAG) \
|
||||
: transform<BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{ \
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
struct impl \
|
||||
: transform_impl<Expr, State, Data> \
|
||||
{ \
|
||||
private: \
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0; \
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
|
||||
public: \
|
||||
BOOST_PROTO_DECLTYPE_(OP proto::detail::MAKE<r0>(), result_type) \
|
||||
result_type operator ()( \
|
||||
typename impl::expr_param e \
|
||||
, typename impl::state_param s \
|
||||
, typename impl::data_param d \
|
||||
) const \
|
||||
{ \
|
||||
typename Grammar::template impl<e0, State, Data> t0; \
|
||||
return OP t0(proto::child_c<0>(e), s, d); \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
template<typename Grammar> \
|
||||
struct default_case<Grammar, tag::TAG> \
|
||||
: when<unary_expr<tag::TAG, Grammar>, BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_BINARY_DEFAULT_EVAL(OP, TAG, LMAKE, RMAKE) \
|
||||
template<typename Grammar> \
|
||||
struct BOOST_PP_CAT(default_, TAG) \
|
||||
: transform<BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{ \
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
struct impl \
|
||||
: transform_impl<Expr, State, Data> \
|
||||
{ \
|
||||
private: \
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0; \
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1; \
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1; \
|
||||
public: \
|
||||
BOOST_PROTO_DECLTYPE_( \
|
||||
proto::detail::LMAKE<r0>() OP proto::detail::RMAKE<r1>() \
|
||||
, result_type \
|
||||
) \
|
||||
result_type operator ()( \
|
||||
typename impl::expr_param e \
|
||||
, typename impl::state_param s \
|
||||
, typename impl::data_param d \
|
||||
) const \
|
||||
{ \
|
||||
typename Grammar::template impl<e0, State, Data> t0; \
|
||||
typename Grammar::template impl<e1, State, Data> t1; \
|
||||
return t0(proto::child_c<0>(e), s, d) \
|
||||
OP t1(proto::child_c<1>(e), s, d); \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
template<typename Grammar> \
|
||||
struct default_case<Grammar, tag::TAG> \
|
||||
: when<binary_expr<tag::TAG, Grammar, Grammar>, BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(+, unary_plus, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(-, negate, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(*, dereference, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(~, complement, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(&, address_of, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(!, logical_not, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(++, pre_inc, make_mutable)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(--, pre_dec, make_mutable)
|
||||
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<<, shift_left, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>>, shift_right, make_mutable, make_mutable)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(*, multiplies, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(/, divides, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(%, modulus, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(+, plus, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(-, minus, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<, less, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>, greater, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<=, less_equal, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>=, greater_equal, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(==, equal_to, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(!=, not_equal_to, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(||, logical_or, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(&&, logical_and, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(&, bitwise_and, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(|, bitwise_or, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(^, bitwise_xor, make, make)
|
||||
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(=, assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<<=, shift_left_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>>=, shift_right_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(*=, multiplies_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(/=, divides_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(%=, modulus_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(+=, plus_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(-=, minus_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(&=, bitwise_and_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(|=, bitwise_or_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(^=, bitwise_xor_assign, make_mutable, make)
|
||||
|
||||
#undef BOOST_PROTO_UNARY_DEFAULT_EVAL
|
||||
#undef BOOST_PROTO_BINARY_DEFAULT_EVAL
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct is_member_function_invocation
|
||||
: is_member_function_pointer<
|
||||
typename uncvref<
|
||||
typename Grammar::template impl<
|
||||
typename result_of::child_c<Expr, 1>::type
|
||||
, State
|
||||
, Data
|
||||
>::result_type
|
||||
>::type
|
||||
>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Grammar, typename Expr, typename State, typename Data, bool IsMemFunCall>
|
||||
struct default_mem_ptr_impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
typedef typename detail::mem_ptr_fun<r0, r1>::result_type result_type;
|
||||
result_type operator ()(
|
||||
typename default_mem_ptr_impl::expr_param e
|
||||
, typename default_mem_ptr_impl::state_param s
|
||||
, typename default_mem_ptr_impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return detail::mem_ptr_fun<r0, r1>()(
|
||||
t0(proto::child_c<0>(e), s, d)
|
||||
, t1(proto::child_c<1>(e), s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_mem_ptr_impl<Grammar, Expr, State, Data, true>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
typedef detail::memfun<r0, r1> result_type;
|
||||
result_type const operator ()(
|
||||
typename default_mem_ptr_impl::expr_param e
|
||||
, typename default_mem_ptr_impl::state_param s
|
||||
, typename default_mem_ptr_impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return detail::memfun<r0, r1>(
|
||||
t0(proto::child_c<0>(e), s, d)
|
||||
, t1(proto::child_c<1>(e), s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_mem_ptr
|
||||
: transform<default_mem_ptr<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: default_mem_ptr_impl<
|
||||
Grammar
|
||||
, Expr
|
||||
, State
|
||||
, Data
|
||||
, is_member_function_invocation<Grammar, Expr, State, Data>::value
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::mem_ptr>
|
||||
: when<mem_ptr<Grammar, Grammar>, default_mem_ptr<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_post_inc
|
||||
: transform<default_post_inc<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() ++, result_type)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
return t0(proto::child_c<0>(e), s, d) ++;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::post_inc>
|
||||
: when<post_inc<Grammar>, default_post_inc<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_post_dec
|
||||
: transform<default_post_dec<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() --, result_type)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
return t0(proto::child_c<0>(e), s, d) --;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::post_dec>
|
||||
: when<post_dec<Grammar>, default_post_dec<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_subscript
|
||||
: transform<default_subscript<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(
|
||||
proto::detail::make_subscriptable<r0>() [ proto::detail::make<r1>() ]
|
||||
, result_type
|
||||
)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return t0(proto::child_c<0>(e), s, d) [
|
||||
t1(proto::child_c<1>(e), s, d) ];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::subscript>
|
||||
: when<subscript<Grammar, Grammar>, default_subscript<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_if_else_
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename result_of::child_c<Expr, 2>::type e2;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
typedef typename Grammar::template impl<e2, State, Data>::result_type r2;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(
|
||||
proto::detail::make<r0>()
|
||||
? proto::detail::make<r1>()
|
||||
: proto::detail::make<r2>()
|
||||
, result_type
|
||||
)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
typename Grammar::template impl<e2, State, Data> t2;
|
||||
return t0(proto::child_c<0>(e), s, d)
|
||||
? t1(proto::child_c<1>(e), s, d)
|
||||
: t2(proto::child_c<2>(e), s, d);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::if_else_>
|
||||
: when<if_else_<Grammar, Grammar, Grammar>, default_if_else_<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_comma
|
||||
: transform<default_comma<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
typedef typename proto::detail::comma_result<r0, r1>::type result_type;
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return t0(proto::child_c<0>(e), s, d)
|
||||
, t1(proto::child_c<1>(e), s, d);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::comma>
|
||||
: when<comma<Grammar, Grammar>, default_comma<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data, long Arity>
|
||||
struct default_function_impl;
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_function
|
||||
: transform<default_function<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: default_function_impl<
|
||||
Grammar
|
||||
, Expr
|
||||
, State
|
||||
, Data
|
||||
, transform_impl<Expr, State, Data>::expr::proto_arity_c
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::function>
|
||||
: when<function<Grammar, vararg<Grammar> >, default_function<Grammar> >
|
||||
{};
|
||||
|
||||
#define BOOST_PROTO_DEFAULT_EVAL_TYPE(Z, N, DATA) \
|
||||
typedef \
|
||||
typename result_of::child_c<DATA, N>::type \
|
||||
BOOST_PP_CAT(e, N); \
|
||||
\
|
||||
typedef \
|
||||
typename Grammar::template impl<BOOST_PP_CAT(e, N), State, Data>::result_type \
|
||||
BOOST_PP_CAT(r, N); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_DEFAULT_EVAL(Z, N, DATA) \
|
||||
typename Grammar::template impl<BOOST_PP_CAT(e, N), State, Data>()( \
|
||||
proto::child_c<N>(DATA), s, d \
|
||||
) \
|
||||
/**/
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 1>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
|
||||
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<function_type()>::type
|
||||
result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 2>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
|
||||
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 1, Expr)
|
||||
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
|
||||
typedef
|
||||
typename detail::result_of_<function_type(r1)>::type
|
||||
result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(
|
||||
e
|
||||
, s
|
||||
, d
|
||||
, is_member_function_pointer<function_type>()
|
||||
, is_member_object_pointer<function_type>()
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(BOOST_PROTO_DEFAULT_EVAL(~, 1, e));
|
||||
}
|
||||
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->*
|
||||
BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
|
||||
)();
|
||||
}
|
||||
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->*
|
||||
BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/proto/transform/detail/default_function_impl.hpp>
|
||||
|
||||
#undef BOOST_PROTO_DEFAULT_EVAL_TYPE
|
||||
#undef BOOST_PROTO_DEFAULT_EVAL
|
||||
}
|
||||
|
||||
template<typename Grammar /*= detail::_default*/>
|
||||
struct _default
|
||||
: switch_<detail::default_cases<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct is_callable<_default<Grammar> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Loopy indirection that allows proto::_default<> to be
|
||||
// used without specifying a Grammar argument.
|
||||
struct _default
|
||||
: proto::_default<>
|
||||
{};
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/call.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_NTH_RESULT_TYPE(Z, M, DATA) \
|
||||
typedef \
|
||||
typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data> \
|
||||
BOOST_PP_CAT(a, M); \
|
||||
typedef typename BOOST_PP_CAT(a, M)::result_type BOOST_PP_CAT(b, M); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_NTH_RESULT(Z, M, DATA) \
|
||||
detail::as_lvalue(BOOST_PP_CAT(a, M)()(e, s, d)) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/call.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file call.hpp
|
||||
/// Contains definition of the call<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/call.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_NTH_RESULT
|
||||
#undef BOOST_PROTO_NTH_RESULT_TYPE
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
#if N > 3
|
||||
/// \brief Call the PolymorphicFunctionObject \c Fun with the
|
||||
/// current expression, state and data, transformed according
|
||||
/// to \c A0 through \c AN.
|
||||
template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_NTH_RESULT_TYPE, ~)
|
||||
|
||||
typedef detail::poly_function_traits<Fun, Fun(BOOST_PP_ENUM_PARAMS(N, b))> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
/// Let \c ax be <tt>when\<_, Ax\>()(e, s, d)</tt>
|
||||
/// for each \c x in <tt>[0,N]</tt>.
|
||||
/// Return <tt>Fun()(a0, a1,... aN)</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(BOOST_PP_ENUM(N, BOOST_PROTO_NTH_RESULT, ~));
|
||||
}
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
#if N > 0
|
||||
/// \brief Call the PolymorphicFunctionObject \c Fun with the
|
||||
/// current expression, state and data, transformed according
|
||||
/// to \c A0 through \c AN.
|
||||
template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value // BUGBUG this isn't right. Could be pack(_child), should use arity of child!
|
||||
, BOOST_PP_CAT(A, BOOST_PP_DEC(N))
|
||||
, detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
|
||||
Fun
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/construct_funop.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/construct_funop.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file construct_funop.hpp
|
||||
/// Overloads of construct_\<\>::operator().
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/construct_funop.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a)) const
|
||||
{
|
||||
return Type(BOOST_PP_ENUM_PARAMS(N, a));
|
||||
}
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/construct_pod_funop.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/construct_pod_funop.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file construct_pod_funop.hpp
|
||||
/// Overloads of construct_\<\>::operator().
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/construct_pod_funop.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a)) const
|
||||
{
|
||||
Type that = {BOOST_PP_ENUM_PARAMS(N, a)};
|
||||
return that;
|
||||
}
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/default_function_impl.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_DEF_FUN_INVOKE_ARG(Z, M, DATA) \
|
||||
BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/default_function_impl.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file default_function_impl.hpp
|
||||
/// Contains definition of the default_function_impl, the implementation of the
|
||||
/// _default transform for function-like nodes.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/default_function_impl.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_DEF_FUN_INVOKE_ARG
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, N>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr)
|
||||
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(BOOST_PP_ENUM_SHIFTED_PARAMS(N, r))
|
||||
>::type
|
||||
result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(
|
||||
BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, e)
|
||||
);
|
||||
}
|
||||
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->*
|
||||
BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
|
||||
)(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEF_FUN_INVOKE_ARG, e));
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/expand_pack.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/expand_pack.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file expand_pack.hpp
|
||||
/// Contains helpers for pseudo-pack expansion.
|
||||
//
|
||||
// Copyright 2012 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/expand_pack.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define N BOOST_PP_ITERATION()
|
||||
#define M0(Z, X, DATA) typename expand_pattern_helper<Tfx, BOOST_PP_CAT(A, X)>::type
|
||||
#define M1(Z, X, DATA) expand_pattern_helper<Tfx, BOOST_PP_CAT(A, X)>::applied::value ||
|
||||
|
||||
template<typename Tfx, typename Ret BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct expand_pattern_helper<Tfx, Ret(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
{
|
||||
typedef Ret (*type)(BOOST_PP_ENUM(N, M0, ~));
|
||||
typedef mpl::bool_<BOOST_PP_REPEAT(N, M1, ~) false> applied;
|
||||
};
|
||||
|
||||
#undef M1
|
||||
#undef M0
|
||||
#undef N
|
||||
#endif
|
||||
@@ -0,0 +1,143 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/fold_impl.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_CHILD_N_TYPE(N) \
|
||||
BOOST_PP_CAT(proto_child, N) \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_FOLD_STATE_TYPE(Z, N, DATA) \
|
||||
typedef \
|
||||
typename when<_, Fun>::template impl< \
|
||||
typename result_of::child_c<Expr, N>::type \
|
||||
, BOOST_PP_CAT(state, N) \
|
||||
, Data \
|
||||
>::result_type \
|
||||
BOOST_PP_CAT(state, BOOST_PP_INC(N)); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_FOLD_STATE(Z, N, DATA) \
|
||||
BOOST_PP_CAT(state, BOOST_PP_INC(N)) \
|
||||
BOOST_PP_CAT(s, BOOST_PP_INC(N)) \
|
||||
= typename when<_, Fun>::template impl< \
|
||||
typename result_of::child_c<Expr, N>::type \
|
||||
, BOOST_PP_CAT(state, N) \
|
||||
, Data \
|
||||
>()( \
|
||||
proto::child_c<N>(e) \
|
||||
, BOOST_PP_CAT(s, N) \
|
||||
, d \
|
||||
); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_REVERSE_FOLD_STATE_TYPE(Z, N, DATA) \
|
||||
typedef \
|
||||
typename when<_, Fun>::template impl< \
|
||||
typename result_of::child_c< \
|
||||
Expr \
|
||||
, BOOST_PP_SUB(DATA, BOOST_PP_INC(N)) \
|
||||
>::type \
|
||||
, BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, N)) \
|
||||
, Data \
|
||||
>::result_type \
|
||||
BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, BOOST_PP_INC(N))); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_REVERSE_FOLD_STATE(Z, N, DATA) \
|
||||
BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, BOOST_PP_INC(N))) \
|
||||
BOOST_PP_CAT(s, BOOST_PP_SUB(DATA, BOOST_PP_INC(N))) \
|
||||
= typename when<_, Fun>::template impl< \
|
||||
typename result_of::child_c< \
|
||||
Expr \
|
||||
, BOOST_PP_SUB(DATA, BOOST_PP_INC(N)) \
|
||||
>::type \
|
||||
, BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, N)) \
|
||||
, Data \
|
||||
>()( \
|
||||
proto::child_c<BOOST_PP_SUB(DATA, BOOST_PP_INC(N))>(e) \
|
||||
, BOOST_PP_CAT(s, BOOST_PP_SUB(DATA, N)) \
|
||||
, d \
|
||||
); \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/fold_impl.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file fold_impl.hpp
|
||||
/// Contains definition of fold_impl<> and reverse_fold_impl<> templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/fold_impl.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_REVERSE_FOLD_STATE
|
||||
#undef BOOST_PROTO_REVERSE_FOLD_STATE_TYPE
|
||||
#undef BOOST_PROTO_FOLD_STATE
|
||||
#undef BOOST_PROTO_FOLD_STATE_TYPE
|
||||
#undef BOOST_PROTO_CHILD_N_TYPE
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, N>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_FOLD_STATE_TYPE, N)
|
||||
typedef BOOST_PP_CAT(state, N) result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_FOLD_STATE, N)
|
||||
return BOOST_PP_CAT(s, N);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, N>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type BOOST_PP_CAT(state, N);
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_REVERSE_FOLD_STATE_TYPE, N)
|
||||
typedef state0 result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
BOOST_PP_CAT(state, N) BOOST_PP_CAT(s, N) =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_REVERSE_FOLD_STATE, N)
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/lazy.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/lazy.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file lazy.hpp
|
||||
/// Contains definition of the lazy<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/lazy.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
/// \brief A PrimitiveTransform that uses <tt>make\<\></tt> to build
|
||||
/// a CallableTransform, and then uses <tt>call\<\></tt> to apply it.
|
||||
///
|
||||
/// <tt>lazy\<\></tt> is useful as a higher-order transform, when the
|
||||
/// transform to be applied depends on the current state of the
|
||||
/// transformation. The invocation of the <tt>make\<\></tt> transform
|
||||
/// evaluates any nested transforms, and the resulting type is treated
|
||||
/// as a CallableTransform, which is evaluated with <tt>call\<\></tt>.
|
||||
template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct lazy<Object(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: transform<lazy<Object(BOOST_PP_ENUM_PARAMS(N, A))> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(BOOST_PP_ENUM_PARAMS(N, A))
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
#if N > 0
|
||||
template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct lazy<Object(BOOST_PP_ENUM_PARAMS(N, A)...)>
|
||||
: transform<lazy<Object(BOOST_PP_ENUM_PARAMS(N, A)...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, BOOST_PP_CAT(A, BOOST_PP_DEC(N))
|
||||
, detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
|
||||
Object
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,202 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/make.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_MAKE_IF(Z, M, DATA) \
|
||||
make_if_<BOOST_PP_CAT(A, M), Expr, State, Data> \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_MAKE_IF_TYPE(Z, M, DATA) \
|
||||
typename BOOST_PROTO_MAKE_IF(Z, M, DATA) ::type \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_MAKE_IF_APPLIED(Z, M, DATA) \
|
||||
BOOST_PROTO_MAKE_IF(Z, M, DATA) ::applied || \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_CONSTRUCT_ARG(Z, M, DATA) \
|
||||
detail::as_lvalue( \
|
||||
typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>()(e, s, d) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/make.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file make.hpp
|
||||
/// Contains definition of the make<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/make.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_CONSTRUCT_ARG
|
||||
#undef BOOST_PROTO_MAKE_IF_APPLIED
|
||||
#undef BOOST_PROTO_MAKE_IF_TYPE
|
||||
#undef BOOST_PROTO_MAKE_IF
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#if N > 0
|
||||
|
||||
template<
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class R
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
|
||||
, typename Expr, typename State, typename Data
|
||||
>
|
||||
struct make_<
|
||||
R<BOOST_PP_ENUM_PARAMS(N, A)>
|
||||
, Expr, State, Data
|
||||
BOOST_PROTO_TEMPLATE_ARITY_PARAM(N)
|
||||
>
|
||||
: nested_type_if<
|
||||
R<BOOST_PP_ENUM(N, BOOST_PROTO_MAKE_IF_TYPE, ~)>
|
||||
, (BOOST_PP_REPEAT(N, BOOST_PROTO_MAKE_IF_APPLIED, ~) false)
|
||||
>
|
||||
{};
|
||||
|
||||
template<
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class R
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
|
||||
, typename Expr, typename State, typename Data
|
||||
>
|
||||
struct make_<
|
||||
noinvoke<R<BOOST_PP_ENUM_PARAMS(N, A)> >
|
||||
, Expr, State, Data
|
||||
BOOST_PROTO_TEMPLATE_ARITY_PARAM(1)
|
||||
>
|
||||
{
|
||||
typedef R<BOOST_PP_ENUM(N, BOOST_PROTO_MAKE_IF_TYPE, ~)> type;
|
||||
static bool const applied = true;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct is_applyable<R(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct is_applyable<R(*)(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
template<typename T, typename A>
|
||||
struct construct_<proto::expr<T, A, N>, true>
|
||||
{
|
||||
typedef proto::expr<T, A, N> result_type;
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const
|
||||
{
|
||||
return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename A>
|
||||
struct construct_<proto::basic_expr<T, A, N>, true>
|
||||
{
|
||||
typedef proto::basic_expr<T, A, N> result_type;
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const
|
||||
{
|
||||
return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Type BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
BOOST_FORCEINLINE
|
||||
Type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a))
|
||||
{
|
||||
return construct_<Type>()(BOOST_PP_ENUM_PARAMS(N, a));
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief A PrimitiveTransform which computes a type by evaluating any
|
||||
/// nested transforms and then constructs an object of that type with the
|
||||
/// current expression, state and data, transformed according
|
||||
/// to \c A0 through \c AN.
|
||||
template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct make<Object(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: transform<make<Object(BOOST_PP_ENUM_PARAMS(N, A))> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
/// \brief <tt>boost::result_of\<make\<Object\>(Expr, State, Data)\>::type</tt>
|
||||
typedef typename detail::make_if_<Object, Expr, State, Data>::type result_type;
|
||||
|
||||
/// Let \c ax be <tt>when\<_, Ax\>()(e, s, d)</tt>
|
||||
/// for each \c x in <tt>[0,N]</tt>.
|
||||
/// Return <tt>result_type(a0, a1,... aN)</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
proto::detail::ignore_unused(e);
|
||||
proto::detail::ignore_unused(s);
|
||||
proto::detail::ignore_unused(d);
|
||||
return detail::construct<result_type>(BOOST_PP_ENUM(N, BOOST_PROTO_CONSTRUCT_ARG, DATA));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#if N > 0
|
||||
/// \brief A PrimitiveTransform which computes a type by evaluating any
|
||||
/// nested transforms and then constructs an object of that type with the
|
||||
/// current expression, state and data, transformed according
|
||||
/// to \c A0 through \c AN.
|
||||
template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct make<Object(BOOST_PP_ENUM_PARAMS(N, A)...)>
|
||||
: transform<make<Object(BOOST_PP_ENUM_PARAMS(N, A)...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: make<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, BOOST_PP_CAT(A, BOOST_PP_DEC(N))
|
||||
, detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
|
||||
Object
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
#endif
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0)
|
||||
#include <boost/proto/transform/detail/preprocessed/make_gcc_workaround.hpp>
|
||||
#endif
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_EXPR_MAKE_ARG(Z, M, DATA) \
|
||||
detail::as_lvalue( \
|
||||
typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>()(e, s, d) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_gcc_workaround.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file make_gcc_workaround.hpp
|
||||
/// Special workaround code to make the make\<\> transform work on certain
|
||||
/// versions of gcc.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0) || \
|
||||
(defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES))
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/make_gcc_workaround.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_EXPR_MAKE_ARG
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
// work around GCC bug
|
||||
template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA)
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA)
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,97 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pack.hpp
|
||||
/// Contains helpers for pseudo-pack expansion.
|
||||
//
|
||||
// Copyright 2012 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
|
||||
#define BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4348) // redefinition of default parameter
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Fun>
|
||||
struct msvc_fun_workaround;
|
||||
|
||||
template<typename Tfx, typename T>
|
||||
struct expand_pattern_helper
|
||||
{
|
||||
typedef T type;
|
||||
typedef mpl::false_ applied;
|
||||
};
|
||||
|
||||
template<typename Tfx, typename Fun>
|
||||
struct expand_pattern_helper<Tfx, Fun *>
|
||||
: expand_pattern_helper<Tfx, Fun>
|
||||
{};
|
||||
|
||||
template<typename Tfx, typename T>
|
||||
struct expand_pattern_helper<Tfx, pack(T)>
|
||||
{
|
||||
// BUGBUG fix me. See comment in transform/detail/call.hpp
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(is_same<T, _>::value)
|
||||
, PACK_EXPANSIONS_OF_EXPRESSIONS_OTHER_THAN_THE_CURRENT_NOT_YET_SUPPORTED
|
||||
, (T)
|
||||
);
|
||||
typedef Tfx type(T);
|
||||
typedef mpl::true_ applied;
|
||||
};
|
||||
|
||||
template<typename Tfx>
|
||||
struct expand_pattern_helper<Tfx, pack(_)>
|
||||
{
|
||||
typedef Tfx type;
|
||||
typedef mpl::true_ applied;
|
||||
};
|
||||
|
||||
#include <boost/proto/transform/detail/expand_pack.hpp>
|
||||
|
||||
template<long Arity, typename Fun, typename Cont>
|
||||
struct expand_pattern;
|
||||
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<0, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_value, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_value, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
|
||||
#include <boost/proto/transform/detail/pack_impl.hpp>
|
||||
}
|
||||
}}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/pack_impl.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/pack_impl.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pack_impl.hpp
|
||||
/// Contains helpers for pseudo-pack expansion.
|
||||
//
|
||||
// Copyright 2012 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_ARITY), <boost/proto/transform/detail/pack_impl.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if BOOST_PP_ITERATION_DEPTH() == 1
|
||||
#define N BOOST_PP_ITERATION()
|
||||
#define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
|
||||
#define M0(Z, X, D) typename expand_pattern_helper<proto::_child_c<X>, Fun>::type
|
||||
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<BOOST_PP_INC(N), Fun, Cont>
|
||||
: Cont::template cat<BOOST_PP_ENUM(BOOST_PP_INC(N), M0, ~)>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
|
||||
template<typename Ret BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct BOOST_PP_CAT(expand_pattern_rest_, N)
|
||||
{
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(M), typename C, void)>
|
||||
struct cat;
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_2 \
|
||||
(3, (1, M, <boost/proto/transform/detail/pack_impl.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
};
|
||||
#undef M0
|
||||
#undef M
|
||||
#undef N
|
||||
#else
|
||||
#define I BOOST_PP_ITERATION()
|
||||
#define J BOOST_PP_RELATIVE_ITERATION(1)
|
||||
template<BOOST_PP_ENUM_PARAMS(I, typename C)>
|
||||
struct cat<BOOST_PP_ENUM_PARAMS(I, C)>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(BOOST_PP_ENUM_PARAMS(J, A) BOOST_PP_COMMA_IF(J) BOOST_PP_ENUM_PARAMS(I, C))> type;
|
||||
};
|
||||
#undef J
|
||||
#undef I
|
||||
#endif
|
||||
#endif
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/pass_through_impl.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_DEFINE_TRANSFORM_TYPE(Z, N, DATA) \
|
||||
typename Grammar::BOOST_PP_CAT(proto_child, N)::template impl< \
|
||||
typename result_of::child_c<Expr, N>::type \
|
||||
, State \
|
||||
, Data \
|
||||
>::result_type \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_DEFINE_TRANSFORM(Z, N, DATA) \
|
||||
typename Grammar::BOOST_PP_CAT(proto_child, N)::template impl< \
|
||||
typename result_of::child_c<Expr, N>::type \
|
||||
, State \
|
||||
, Data \
|
||||
>()( \
|
||||
e.proto_base().BOOST_PP_CAT(child, N), s, d \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/pass_through_impl.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pass_through_impl.hpp
|
||||
///
|
||||
/// Specializations of pass_through_impl, used in the implementation of the
|
||||
/// pass_through transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/pass_through_impl.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_TRANSFORM
|
||||
#undef BOOST_PROTO_DEFINE_TRANSFORM_TYPE
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, N>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, BOOST_PP_CAT(list, N)<
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM_TYPE, ~)
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM, ~)
|
||||
};
|
||||
// Without this, MSVC complains that "that" is uninitialized,
|
||||
// and it actually triggers a runtime check in debug mode when
|
||||
// built with VC8.
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
+424
@@ -0,0 +1,424 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file call.hpp
|
||||
/// Contains definition of the call<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0>
|
||||
struct call<Fun(A0...)> : transform<call<Fun(A0...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A0
|
||||
, detail::expand_pattern_rest_0<
|
||||
Fun
|
||||
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1>
|
||||
struct call<Fun(A0 , A1...)> : transform<call<Fun(A0 , A1...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A1
|
||||
, detail::expand_pattern_rest_1<
|
||||
Fun
|
||||
, A0
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2>
|
||||
struct call<Fun(A0 , A1 , A2...)> : transform<call<Fun(A0 , A1 , A2...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A2
|
||||
, detail::expand_pattern_rest_2<
|
||||
Fun
|
||||
, A0 , A1
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct call<Fun(A0 , A1 , A2 , A3)> : transform<call<Fun(A0 , A1 , A2 , A3)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct call<Fun(A0 , A1 , A2 , A3...)> : transform<call<Fun(A0 , A1 , A2 , A3...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A3
|
||||
, detail::expand_pattern_rest_3<
|
||||
Fun
|
||||
, A0 , A1 , A2
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3; typedef typename when<_, A4>::template impl<Expr, State, Data> a4; typedef typename a4::result_type b4;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3 , b4)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)) , detail::as_lvalue(a4()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A4
|
||||
, detail::expand_pattern_rest_4<
|
||||
Fun
|
||||
, A0 , A1 , A2 , A3
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3; typedef typename when<_, A4>::template impl<Expr, State, Data> a4; typedef typename a4::result_type b4; typedef typename when<_, A5>::template impl<Expr, State, Data> a5; typedef typename a5::result_type b5;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3 , b4 , b5)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)) , detail::as_lvalue(a4()(e, s, d)) , detail::as_lvalue(a5()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A5
|
||||
, detail::expand_pattern_rest_5<
|
||||
Fun
|
||||
, A0 , A1 , A2 , A3 , A4
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3; typedef typename when<_, A4>::template impl<Expr, State, Data> a4; typedef typename a4::result_type b4; typedef typename when<_, A5>::template impl<Expr, State, Data> a5; typedef typename a5::result_type b5; typedef typename when<_, A6>::template impl<Expr, State, Data> a6; typedef typename a6::result_type b6;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3 , b4 , b5 , b6)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)) , detail::as_lvalue(a4()(e, s, d)) , detail::as_lvalue(a5()(e, s, d)) , detail::as_lvalue(a6()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A6
|
||||
, detail::expand_pattern_rest_6<
|
||||
Fun
|
||||
, A0 , A1 , A2 , A3 , A4 , A5
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3; typedef typename when<_, A4>::template impl<Expr, State, Data> a4; typedef typename a4::result_type b4; typedef typename when<_, A5>::template impl<Expr, State, Data> a5; typedef typename a5::result_type b5; typedef typename when<_, A6>::template impl<Expr, State, Data> a6; typedef typename a6::result_type b6; typedef typename when<_, A7>::template impl<Expr, State, Data> a7; typedef typename a7::result_type b7;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3 , b4 , b5 , b6 , b7)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)) , detail::as_lvalue(a4()(e, s, d)) , detail::as_lvalue(a5()(e, s, d)) , detail::as_lvalue(a6()(e, s, d)) , detail::as_lvalue(a7()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A7
|
||||
, detail::expand_pattern_rest_7<
|
||||
Fun
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3; typedef typename when<_, A4>::template impl<Expr, State, Data> a4; typedef typename a4::result_type b4; typedef typename when<_, A5>::template impl<Expr, State, Data> a5; typedef typename a5::result_type b5; typedef typename when<_, A6>::template impl<Expr, State, Data> a6; typedef typename a6::result_type b6; typedef typename when<_, A7>::template impl<Expr, State, Data> a7; typedef typename a7::result_type b7; typedef typename when<_, A8>::template impl<Expr, State, Data> a8; typedef typename a8::result_type b8;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3 , b4 , b5 , b6 , b7 , b8)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)) , detail::as_lvalue(a4()(e, s, d)) , detail::as_lvalue(a5()(e, s, d)) , detail::as_lvalue(a6()(e, s, d)) , detail::as_lvalue(a7()(e, s, d)) , detail::as_lvalue(a8()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A8
|
||||
, detail::expand_pattern_rest_8<
|
||||
Fun
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, A0>::template impl<Expr, State, Data> a0; typedef typename a0::result_type b0; typedef typename when<_, A1>::template impl<Expr, State, Data> a1; typedef typename a1::result_type b1; typedef typename when<_, A2>::template impl<Expr, State, Data> a2; typedef typename a2::result_type b2; typedef typename when<_, A3>::template impl<Expr, State, Data> a3; typedef typename a3::result_type b3; typedef typename when<_, A4>::template impl<Expr, State, Data> a4; typedef typename a4::result_type b4; typedef typename when<_, A5>::template impl<Expr, State, Data> a5; typedef typename a5::result_type b5; typedef typename when<_, A6>::template impl<Expr, State, Data> a6; typedef typename a6::result_type b6; typedef typename when<_, A7>::template impl<Expr, State, Data> a7; typedef typename a7::result_type b7; typedef typename when<_, A8>::template impl<Expr, State, Data> a8; typedef typename a8::result_type b8; typedef typename when<_, A9>::template impl<Expr, State, Data> a9; typedef typename a9::result_type b9;
|
||||
typedef detail::poly_function_traits<Fun, Fun(b0 , b1 , b2 , b3 , b4 , b5 , b6 , b7 , b8 , b9)> function_traits;
|
||||
typedef typename function_traits::result_type result_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typedef typename function_traits::function_type function_type;
|
||||
return function_type()(detail::as_lvalue(a0()(e, s, d)) , detail::as_lvalue(a1()(e, s, d)) , detail::as_lvalue(a2()(e, s, d)) , detail::as_lvalue(a3()(e, s, d)) , detail::as_lvalue(a4()(e, s, d)) , detail::as_lvalue(a5()(e, s, d)) , detail::as_lvalue(a6()(e, s, d)) , detail::as_lvalue(a7()(e, s, d)) , detail::as_lvalue(a8()(e, s, d)) , detail::as_lvalue(a9()(e, s, d)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A9
|
||||
, detail::expand_pattern_rest_9<
|
||||
Fun
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file construct_funop.hpp
|
||||
/// Overloads of construct_\<\>::operator().
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename A0>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0) const
|
||||
{
|
||||
return Type(a0);
|
||||
}
|
||||
template<typename A0 , typename A1>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1) const
|
||||
{
|
||||
return Type(a0 , a1);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2) const
|
||||
{
|
||||
return Type(a0 , a1 , a2);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7 , A8 &a8) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7 , A8 &a8 , A9 &a9) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file construct_pod_funop.hpp
|
||||
/// Overloads of construct_\<\>::operator().
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename A0>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0) const
|
||||
{
|
||||
Type that = {a0};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1) const
|
||||
{
|
||||
Type that = {a0 , a1};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3 , a4};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3 , a4 , a5};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3 , a4 , a5 , a6};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7 , A8 &a8) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8};
|
||||
return that;
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7 , A8 &a8 , A9 &a9) const
|
||||
{
|
||||
Type that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9};
|
||||
return that;
|
||||
}
|
||||
+392
@@ -0,0 +1,392 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file default_function_impl.hpp
|
||||
/// Contains definition of the default_function_impl, the implementation of the
|
||||
/// _default transform for function-like nodes.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 3>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 4>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 5>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 6>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 7>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 8>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6; typedef typename result_of::child_c< Expr, 7>::type e7; typedef typename Grammar::template impl<e7, State, Data>::result_type r7;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6 , r7)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 9>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6; typedef typename result_of::child_c< Expr, 7>::type e7; typedef typename Grammar::template impl<e7, State, Data>::result_type r7; typedef typename result_of::child_c< Expr, 8>::type e8; typedef typename Grammar::template impl<e8, State, Data>::result_type r8;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6 , r7 , r8)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 10>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6; typedef typename result_of::child_c< Expr, 7>::type e7; typedef typename Grammar::template impl<e7, State, Data>::result_type r7; typedef typename result_of::child_c< Expr, 8>::type e8; typedef typename Grammar::template impl<e8, State, Data>::result_type r8; typedef typename result_of::child_c< Expr, 9>::type e9; typedef typename Grammar::template impl<e9, State, Data>::result_type r9;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6 , r7 , r8 , r9)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ) , typename Grammar::template impl<e9, State, Data>()( proto::child_c< 9>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ) , typename Grammar::template impl<e9, State, Data>()( proto::child_c< 9>( e), s, d ));
|
||||
}
|
||||
};
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file expand_pack.hpp
|
||||
/// Contains helpers for pseudo-pack expansion.
|
||||
//
|
||||
// Copyright 2012 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Tfx, typename Ret >
|
||||
struct expand_pattern_helper<Tfx, Ret()>
|
||||
{
|
||||
typedef Ret (*type)();
|
||||
typedef mpl::bool_< false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type , typename expand_pattern_helper<Tfx, A7>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || expand_pattern_helper<Tfx, A7>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type , typename expand_pattern_helper<Tfx, A7>::type , typename expand_pattern_helper<Tfx, A8>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || expand_pattern_helper<Tfx, A7>::applied::value || expand_pattern_helper<Tfx, A8>::applied::value || false> applied;
|
||||
};
|
||||
template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
{
|
||||
typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type , typename expand_pattern_helper<Tfx, A7>::type , typename expand_pattern_helper<Tfx, A8>::type , typename expand_pattern_helper<Tfx, A9>::type);
|
||||
typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || expand_pattern_helper<Tfx, A7>::applied::value || expand_pattern_helper<Tfx, A8>::applied::value || expand_pattern_helper<Tfx, A9>::applied::value || false> applied;
|
||||
};
|
||||
+387
@@ -0,0 +1,387 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file fold_impl.hpp
|
||||
/// Contains definition of fold_impl<> and reverse_fold_impl<> templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 1>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1;
|
||||
typedef state1 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d );
|
||||
return s1;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 1>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state1;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state1 s1 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 2>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2;
|
||||
typedef state2 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d );
|
||||
return s2;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 2>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state2;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state2 s2 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 3>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3;
|
||||
typedef state3 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d );
|
||||
return s3;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 3>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state3;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state3 s3 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 4>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4;
|
||||
typedef state4 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d );
|
||||
return s4;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 4>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state4;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state4 s4 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 5>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5;
|
||||
typedef state5 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d );
|
||||
return s5;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 5>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state5;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state5 s5 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 6>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6;
|
||||
typedef state6 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d );
|
||||
return s6;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 6>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state6;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state6 s6 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 7>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7;
|
||||
typedef state7 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d );
|
||||
return s7;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 7>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state7;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state7 s7 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 8>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >::result_type state8;
|
||||
typedef state8 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >()( proto::child_c< 7>(e) , s7 , d );
|
||||
return s8;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 8>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state8;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state8 s8 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >()( proto::child_c<7>(e) , s8 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 9>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >::result_type state9;
|
||||
typedef state9 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >()( proto::child_c< 7>(e) , s7 , d ); state9 s9 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >()( proto::child_c< 8>(e) , s8 , d );
|
||||
return s9;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 9>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state9;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state9 s9 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >()( proto::child_c<8>(e) , s9 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >()( proto::child_c<7>(e) , s8 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct fold_impl<State0, Fun, Expr, State, Data, 10>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >::result_type state9; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 9>::type , state9 , Data >::result_type state10;
|
||||
typedef state10 result_type;
|
||||
result_type operator ()(
|
||||
typename fold_impl::expr_param e
|
||||
, typename fold_impl::state_param s
|
||||
, typename fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state0 s0 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >()( proto::child_c< 7>(e) , s7 , d ); state9 s9 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >()( proto::child_c< 8>(e) , s8 , d ); state10 s10 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 9>::type , state9 , Data >()( proto::child_c< 9>(e) , s9 , d );
|
||||
return s10;
|
||||
}
|
||||
};
|
||||
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
|
||||
struct reverse_fold_impl<State0, Fun, Expr, State, Data, 10>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state10;
|
||||
typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 9 >::type , state10 , Data >::result_type state9; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
|
||||
typedef state0 result_type;
|
||||
result_type operator ()(
|
||||
typename reverse_fold_impl::expr_param e
|
||||
, typename reverse_fold_impl::state_param s
|
||||
, typename reverse_fold_impl::data_param d
|
||||
) const
|
||||
{
|
||||
state10 s10 =
|
||||
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
|
||||
state9 s9 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 9 >::type , state10 , Data >()( proto::child_c<9>(e) , s10 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >()( proto::child_c<8>(e) , s9 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >()( proto::child_c<7>(e) , s8 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
+407
@@ -0,0 +1,407 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file lazy.hpp
|
||||
/// Contains definition of the lazy<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object >
|
||||
struct lazy<Object()>
|
||||
: transform<lazy<Object()> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
()
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0>
|
||||
struct lazy<Object(A0)>
|
||||
: transform<lazy<Object(A0)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0>
|
||||
struct lazy<Object(A0...)>
|
||||
: transform<lazy<Object(A0...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A0
|
||||
, detail::expand_pattern_rest_0<
|
||||
Object
|
||||
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1>
|
||||
struct lazy<Object(A0 , A1)>
|
||||
: transform<lazy<Object(A0 , A1)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1>
|
||||
struct lazy<Object(A0 , A1...)>
|
||||
: transform<lazy<Object(A0 , A1...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A1
|
||||
, detail::expand_pattern_rest_1<
|
||||
Object
|
||||
, A0
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2>
|
||||
struct lazy<Object(A0 , A1 , A2)>
|
||||
: transform<lazy<Object(A0 , A1 , A2)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2>
|
||||
struct lazy<Object(A0 , A1 , A2...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A2
|
||||
, detail::expand_pattern_rest_2<
|
||||
Object
|
||||
, A0 , A1
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A3
|
||||
, detail::expand_pattern_rest_3<
|
||||
Object
|
||||
, A0 , A1 , A2
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3 , A4)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A4
|
||||
, detail::expand_pattern_rest_4<
|
||||
Object
|
||||
, A0 , A1 , A2 , A3
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3 , A4 , A5)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A5
|
||||
, detail::expand_pattern_rest_5<
|
||||
Object
|
||||
, A0 , A1 , A2 , A3 , A4
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3 , A4 , A5 , A6)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A6
|
||||
, detail::expand_pattern_rest_6<
|
||||
Object
|
||||
, A0 , A1 , A2 , A3 , A4 , A5
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A7
|
||||
, detail::expand_pattern_rest_7<
|
||||
Object
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A8
|
||||
, detail::expand_pattern_rest_8<
|
||||
Object
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
|
||||
: transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: lazy<
|
||||
typename detail::expand_pattern<
|
||||
proto::arity_of<Expr>::value
|
||||
, A9
|
||||
, detail::expand_pattern_rest_9<
|
||||
Object
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
|
||||
>
|
||||
>::type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
+1320
File diff suppressed because it is too large
Load Diff
+481
@@ -0,0 +1,481 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file make_gcc_workaround.hpp
|
||||
/// Special workaround code to make the make\<\> transform work on certain
|
||||
/// versions of gcc.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
template<typename Tag, typename Args, long Arity >
|
||||
struct make<proto::expr<Tag, Args, Arity>()>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>()> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity >
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>()>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>()> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A7>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A7>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A7>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A8>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A7>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A8>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
: transform<make<proto::expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A7>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A8>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A9>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
template<typename Tag, typename Args, long Arity , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
: transform<make<proto::basic_expr<Tag, Args, Arity>(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, Arity> result_type;
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return proto::basic_expr<Tag, Args, Arity>::make(
|
||||
detail::as_lvalue( typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A3>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A4>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A5>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A6>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A7>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A8>::template impl<Expr, State, Data>()(e, s, d) ) , detail::as_lvalue( typename when<_, A9>::template impl<Expr, State, Data>()(e, s, d) )
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
+442
@@ -0,0 +1,442 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pack_impl.hpp
|
||||
/// Contains helpers for pseudo-pack expansion.
|
||||
//
|
||||
// Copyright 2012 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<1, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret >
|
||||
struct expand_pattern_rest_0
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void , typename C8 = void , typename C9 = void , typename C10 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7 , typename C8>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7 , typename C8 , typename C9>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<2, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0>
|
||||
struct expand_pattern_rest_1
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void , typename C8 = void , typename C9 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5 , C6)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7 , typename C8>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<3, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1>
|
||||
struct expand_pattern_rest_2
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void , typename C8 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4 , C5)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4 , C5 , C6)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<4, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2>
|
||||
struct expand_pattern_rest_3
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3 , C4)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3 , C4 , C5)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3 , C4 , C5 , C6)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<5, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct expand_pattern_rest_4
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2 , C3 , C4)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4 , C5>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2 , C3 , C4 , C5)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<6, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct expand_pattern_rest_5
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4>
|
||||
struct cat<C0 , C1 , C2 , C3 , C4>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1 , C2 , C3 , C4)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<7, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct expand_pattern_rest_6
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0 , C1 , C2)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2 , typename C3>
|
||||
struct cat<C0 , C1 , C2 , C3>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0 , C1 , C2 , C3)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<8, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 7>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct expand_pattern_rest_7
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , C0 , C1)> type;
|
||||
};
|
||||
template<typename C0 , typename C1 , typename C2>
|
||||
struct cat<C0 , C1 , C2>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , C0 , C1 , C2)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<9, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 7>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 8>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct expand_pattern_rest_8
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void , typename C2 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , C0)> type;
|
||||
};
|
||||
template<typename C0 , typename C1>
|
||||
struct cat<C0 , C1>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , C0 , C1)> type;
|
||||
};
|
||||
};
|
||||
template<typename Fun, typename Cont>
|
||||
struct expand_pattern<10, Fun, Cont>
|
||||
: Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 7>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 8>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 9>, Fun>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
|
||||
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
|
||||
, (Fun)
|
||||
);
|
||||
};
|
||||
template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct expand_pattern_rest_9
|
||||
{
|
||||
template<typename C0 = void , typename C1 = void>
|
||||
struct cat;
|
||||
template<typename C0>
|
||||
struct cat<C0>
|
||||
{
|
||||
typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , C0)> type;
|
||||
};
|
||||
};
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pass_through_impl.hpp
|
||||
///
|
||||
/// Specializations of pass_through_impl, used in the implementation of the
|
||||
/// pass_through transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 1>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list1<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 2>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list2<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 3>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list3<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 4>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list4<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 5>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list5<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d ) , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >()( e.proto_base().child4, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 6>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list6<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d ) , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >()( e.proto_base().child4, s, d ) , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >()( e.proto_base().child5, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 7>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list7<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d ) , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >()( e.proto_base().child4, s, d ) , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >()( e.proto_base().child5, s, d ) , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >()( e.proto_base().child6, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 8>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list8<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d ) , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >()( e.proto_base().child4, s, d ) , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >()( e.proto_base().child5, s, d ) , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >()( e.proto_base().child6, s, d ) , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >()( e.proto_base().child7, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 9>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list9<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >::result_type , typename Grammar::proto_child8::template impl< typename result_of::child_c<Expr, 8>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d ) , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >()( e.proto_base().child4, s, d ) , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >()( e.proto_base().child5, s, d ) , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >()( e.proto_base().child6, s, d ) , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >()( e.proto_base().child7, s, d ) , typename Grammar::proto_child8::template impl< typename result_of::child_c<Expr, 8>::type , State , Data >()( e.proto_base().child8, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 10>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename pass_through_impl::expr unref_expr;
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_same<Domain, deduce_domain>::value
|
||||
, typename unref_expr::proto_domain
|
||||
, Domain
|
||||
>::type
|
||||
result_domain;
|
||||
typedef
|
||||
typename base_expr<
|
||||
result_domain
|
||||
, typename unref_expr::proto_tag
|
||||
, list10<
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >::result_type , typename Grammar::proto_child8::template impl< typename result_of::child_c<Expr, 8>::type , State , Data >::result_type , typename Grammar::proto_child9::template impl< typename result_of::child_c<Expr, 9>::type , State , Data >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename result_domain::proto_generator proto_generator;
|
||||
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
|
||||
operator ()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param s
|
||||
, typename pass_through_impl::data_param d
|
||||
) const
|
||||
{
|
||||
expr_type const that = {
|
||||
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >()( e.proto_base().child0, s, d ) , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >()( e.proto_base().child1, s, d ) , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >()( e.proto_base().child2, s, d ) , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >()( e.proto_base().child3, s, d ) , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >()( e.proto_base().child4, s, d ) , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >()( e.proto_base().child5, s, d ) , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >()( e.proto_base().child6, s, d ) , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >()( e.proto_base().child7, s, d ) , typename Grammar::proto_child8::template impl< typename result_of::child_c<Expr, 8>::type , State , Data >()( e.proto_base().child8, s, d ) , typename Grammar::proto_child9::template impl< typename result_of::child_c<Expr, 9>::type , State , Data >()( e.proto_base().child9, s, d )
|
||||
};
|
||||
|
||||
|
||||
|
||||
detail::ignore_unused(&that);
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
+637
@@ -0,0 +1,637 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file when.hpp
|
||||
/// Definition of when transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R >
|
||||
struct when<Grammar, R()>
|
||||
: detail::when_impl<Grammar, R, R()>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0>
|
||||
struct when<Grammar, R(A0)>
|
||||
: detail::when_impl<Grammar, R, R(A0)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0>
|
||||
struct when<Grammar, R(A0...)>
|
||||
: detail::when_impl<Grammar, R, R(A0...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1>
|
||||
struct when<Grammar, R(A0 , A1)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1>
|
||||
struct when<Grammar, R(A0 , A1...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2>
|
||||
struct when<Grammar, R(A0 , A1 , A2)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2>
|
||||
struct when<Grammar, R(A0 , A1 , A2...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
|
||||
: detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
|
||||
{};
|
||||
@@ -0,0 +1,101 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/transform/detail/preprocessed/when.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/when.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file when.hpp
|
||||
/// Definition of when transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/when.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
/// \brief A grammar element and a PrimitiveTransform that associates
|
||||
/// a transform with the grammar.
|
||||
///
|
||||
/// Use <tt>when\<\></tt> to override a grammar's default transform
|
||||
/// with a custom transform. It is for used when composing larger
|
||||
/// transforms by associating smaller transforms with individual
|
||||
/// rules in your grammar, as in the following transform which
|
||||
/// counts the number of terminals in an expression.
|
||||
///
|
||||
/// \code
|
||||
/// // Count the terminals in an expression tree.
|
||||
/// // Must be invoked with initial state == mpl::int_<0>().
|
||||
/// struct CountLeaves
|
||||
/// : or_<
|
||||
/// when<terminal<_>, mpl::next<_state>()>
|
||||
/// , otherwise<fold<_, _state, CountLeaves> >
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// The <tt>when\<G, R(A0,A1,...)\></tt> form accepts either a
|
||||
/// CallableTransform or an ObjectTransform as its second parameter.
|
||||
/// <tt>when\<\></tt> uses <tt>is_callable\<R\>::value</tt> to
|
||||
/// distinguish between the two, and uses <tt>call\<\></tt> to
|
||||
/// evaluate CallableTransforms and <tt>make\<\></tt> to evaluate
|
||||
/// ObjectTransforms.
|
||||
template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: detail::when_impl<Grammar, R, R(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
{};
|
||||
|
||||
#if N > 0
|
||||
/// \brief A grammar element and a PrimitiveTransform that associates
|
||||
/// a transform with the grammar.
|
||||
///
|
||||
/// Use <tt>when\<\></tt> to override a grammar's default transform
|
||||
/// with a custom transform. It is for used when composing larger
|
||||
/// transforms by associating smaller transforms with individual
|
||||
/// rules in your grammar, as in the following transform which
|
||||
/// counts the number of terminals in an expression.
|
||||
///
|
||||
/// \code
|
||||
/// // Count the terminals in an expression tree.
|
||||
/// // Must be invoked with initial state == mpl::int_<0>().
|
||||
/// struct CountLeaves
|
||||
/// : or_<
|
||||
/// when<terminal<_>, mpl::next<_state>()>
|
||||
/// , otherwise<fold<_, _state, CountLeaves> >
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// The <tt>when\<G, R(A0,A1,...)\></tt> form accepts either a
|
||||
/// CallableTransform or an ObjectTransform as its second parameter.
|
||||
/// <tt>when\<\></tt> uses <tt>is_callable\<R\>::value</tt> to
|
||||
/// distinguish between the two, and uses <tt>call\<\></tt> to
|
||||
/// evaluate CallableTransforms and <tt>make\<\></tt> to evaluate
|
||||
/// ObjectTransforms.
|
||||
template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A)...)>
|
||||
: detail::when_impl<Grammar, R, R(BOOST_PP_ENUM_PARAMS(N, A)...)>
|
||||
{};
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,515 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// env.hpp
|
||||
// Helpers for producing and consuming tranform env variables.
|
||||
//
|
||||
// Copyright 2012 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_ENV_HPP_EAN_18_07_2012
|
||||
#define BOOST_PROTO_TRANSFORM_ENV_HPP_EAN_18_07_2012
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/detail/poly_function.hpp>
|
||||
#include <boost/proto/detail/is_noncopyable.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct value_type
|
||||
{
|
||||
typedef typename remove_const<T>::type value;
|
||||
typedef typename add_reference<T>::type reference;
|
||||
typedef typename mpl::if_c<is_noncopyable<T>::value, reference, value>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct value_type<T &>
|
||||
{
|
||||
typedef T &value;
|
||||
typedef T &reference;
|
||||
typedef T &type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_PROTO_DEFINE_ENV_VAR(TAG, NAME) \
|
||||
struct TAG \
|
||||
{ \
|
||||
template<typename Value> \
|
||||
boost::proto::env<TAG, Value &> const \
|
||||
operator =(boost::reference_wrapper<Value> &value) const \
|
||||
{ \
|
||||
return boost::proto::env<TAG, Value &>(value.get()); \
|
||||
} \
|
||||
template<typename Value> \
|
||||
boost::proto::env<TAG, Value &> const \
|
||||
operator =(boost::reference_wrapper<Value> const &value) const \
|
||||
{ \
|
||||
return boost::proto::env<TAG, Value &>(value.get()); \
|
||||
} \
|
||||
template<typename Value> \
|
||||
typename boost::disable_if_c< \
|
||||
boost::is_const<Value>::value \
|
||||
, boost::proto::env<TAG, typename boost::proto::detail::value_type<Value>::type> \
|
||||
>::type const operator =(Value &value) const \
|
||||
{ \
|
||||
return boost::proto::env<TAG, typename boost::proto::detail::value_type<Value>::type>(value); \
|
||||
} \
|
||||
template<typename Value> \
|
||||
boost::proto::env<TAG, typename boost::proto::detail::value_type<Value const>::type> const \
|
||||
operator =(Value const &value) const \
|
||||
{ \
|
||||
return boost::proto::env<TAG, typename boost::proto::detail::value_type<Value const>::type>(value); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
TAG const NAME = {} \
|
||||
/**/
|
||||
|
||||
namespace envns_
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// env
|
||||
// A transform env is a slot-based storage mechanism, accessible by tag.
|
||||
template<typename Key, typename Value, typename Base /*= empty_env*/>
|
||||
struct env
|
||||
: private Base
|
||||
{
|
||||
private:
|
||||
Value value_;
|
||||
|
||||
public:
|
||||
typedef Value value_type;
|
||||
typedef typename add_reference<Value>::type reference;
|
||||
typedef typename add_reference<typename add_const<Value>::type>::type const_reference;
|
||||
typedef void proto_environment_; ///< INTERNAL ONLY
|
||||
|
||||
explicit env(const_reference value, Base const &base = Base())
|
||||
: Base(base)
|
||||
, value_(value)
|
||||
{}
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ <= 2)
|
||||
/// INTERNAL ONLY
|
||||
struct found
|
||||
{
|
||||
typedef Value type;
|
||||
typedef typename add_reference<typename add_const<Value>::type>::type const_reference;
|
||||
};
|
||||
|
||||
template<typename OtherKey, typename OtherValue = key_not_found>
|
||||
struct lookup
|
||||
: mpl::if_c<
|
||||
is_same<OtherKey, Key>::value
|
||||
, found
|
||||
, typename Base::template lookup<OtherKey, OtherValue>
|
||||
>::type
|
||||
{};
|
||||
#else
|
||||
/// INTERNAL ONLY
|
||||
template<typename OtherKey, typename OtherValue = key_not_found>
|
||||
struct lookup
|
||||
: Base::template lookup<OtherKey, OtherValue>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename OtherValue>
|
||||
struct lookup<Key, OtherValue>
|
||||
{
|
||||
typedef Value type;
|
||||
typedef typename add_reference<typename add_const<Value>::type>::type const_reference;
|
||||
};
|
||||
#endif
|
||||
|
||||
// For key-based lookups not intended to fail
|
||||
using Base::operator[];
|
||||
const_reference operator[](Key) const
|
||||
{
|
||||
return this->value_;
|
||||
}
|
||||
|
||||
// For key-based lookups that can fail, use the default if key not found.
|
||||
using Base::at;
|
||||
template<typename T>
|
||||
const_reference at(Key, T const &) const
|
||||
{
|
||||
return this->value_;
|
||||
}
|
||||
};
|
||||
|
||||
// define proto::data_type type and proto::data global
|
||||
BOOST_PROTO_DEFINE_ENV_VAR(data_type, data);
|
||||
}
|
||||
|
||||
using envns_::data;
|
||||
|
||||
namespace functional
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// as_env
|
||||
struct as_env
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
BOOST_PROTO_POLY_FUNCTION()
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, bool B = is_env<T>::value>
|
||||
struct impl
|
||||
{
|
||||
typedef env<data_type, typename detail::value_type<T>::type> result_type;
|
||||
|
||||
result_type const operator()(detail::arg<T> t) const
|
||||
{
|
||||
return result_type(t());
|
||||
}
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct impl<T, true>
|
||||
{
|
||||
typedef T result_type;
|
||||
|
||||
typename add_const<T>::type operator()(detail::arg<T> t) const
|
||||
{
|
||||
return t();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename T>
|
||||
struct result<This(T)>
|
||||
{
|
||||
typedef typename impl<typename detail::normalize_arg<T>::type>::result_type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
typename impl<typename detail::normalize_arg<T &>::type>::result_type const
|
||||
operator()(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T)) const
|
||||
{
|
||||
return impl<typename detail::normalize_arg<T &>::type>()(
|
||||
static_cast<typename detail::normalize_arg<T &>::reference>(t)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename impl<typename detail::normalize_arg<T const &>::type>::result_type const
|
||||
operator()(T const &t) const
|
||||
{
|
||||
return impl<typename detail::normalize_arg<T const &>::type>()(
|
||||
static_cast<typename detail::normalize_arg<T const &>::reference>(t)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// has_env_var
|
||||
template<typename Key>
|
||||
struct has_env_var
|
||||
: detail::poly_function<has_env_var<Key> >
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Env, bool IsEnv = is_env<Env>::value>
|
||||
struct impl
|
||||
{
|
||||
typedef
|
||||
mpl::not_<
|
||||
is_same<
|
||||
typename remove_reference<Env>::type::template lookup<Key>::type
|
||||
, key_not_found
|
||||
>
|
||||
>
|
||||
result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env>) const
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Env>
|
||||
struct impl<Env, false>
|
||||
{
|
||||
typedef mpl::false_ result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env>) const
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct has_env_var<data_type>
|
||||
: detail::poly_function<has_env_var<data_type> >
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Env, bool IsEnv = is_env<Env>::value>
|
||||
struct impl
|
||||
{
|
||||
typedef
|
||||
mpl::not_<
|
||||
is_same<
|
||||
typename remove_reference<Env>::type::template lookup<data_type>::type
|
||||
, key_not_found
|
||||
>
|
||||
>
|
||||
result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env>) const
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Env>
|
||||
struct impl<Env, false>
|
||||
{
|
||||
typedef mpl::true_ result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env>) const
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// env_var
|
||||
template<typename Key>
|
||||
struct env_var
|
||||
: detail::poly_function<env_var<Key> >
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Env>
|
||||
struct impl
|
||||
{
|
||||
typedef
|
||||
typename remove_reference<Env>::type::template lookup<Key>::type
|
||||
result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env> e) const
|
||||
{
|
||||
return e()[Key()];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct env_var<data_type>
|
||||
: detail::poly_function<env_var<data_type> >
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Env, bool B = is_env<Env>::value>
|
||||
struct impl
|
||||
{
|
||||
typedef Env result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env> e) const
|
||||
{
|
||||
return e();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Env>
|
||||
struct impl<Env, true>
|
||||
{
|
||||
typedef
|
||||
typename remove_reference<Env>::type::template lookup<data_type>::type
|
||||
result_type;
|
||||
|
||||
result_type operator()(detail::arg<Env> e) const
|
||||
{
|
||||
return e()[proto::data];
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template<typename T>
|
||||
struct as_env
|
||||
: BOOST_PROTO_RESULT_OF<functional::as_env(T)>
|
||||
{};
|
||||
|
||||
template<typename Env, typename Key>
|
||||
struct has_env_var
|
||||
: BOOST_PROTO_RESULT_OF<functional::has_env_var<Key>(Env)>::type
|
||||
{};
|
||||
|
||||
template<typename Env, typename Key>
|
||||
struct env_var
|
||||
: BOOST_PROTO_RESULT_OF<functional::env_var<Key>(Env)>
|
||||
{};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// as_env
|
||||
template<typename T>
|
||||
typename proto::result_of::as_env<T &>::type const as_env(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
|
||||
{
|
||||
return proto::functional::as_env()(t);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename proto::result_of::as_env<T const &>::type const as_env(T const &t)
|
||||
{
|
||||
return proto::functional::as_env()(t);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// has_env_var
|
||||
template<typename Key, typename Env>
|
||||
typename proto::result_of::has_env_var<Env &, Key>::type has_env_var(Env &e BOOST_PROTO_DISABLE_IF_IS_CONST(Env))
|
||||
{
|
||||
return functional::has_env_var<Key>()(e);
|
||||
}
|
||||
|
||||
template<typename Key, typename Env>
|
||||
typename proto::result_of::has_env_var<Env const &, Key>::type has_env_var(Env const &e)
|
||||
{
|
||||
return functional::has_env_var<Key>()(e);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// env_var
|
||||
template<typename Key, typename Env>
|
||||
typename proto::result_of::env_var<Env &, Key>::type env_var(Env &e BOOST_PROTO_DISABLE_IF_IS_CONST(Env))
|
||||
{
|
||||
return functional::env_var<Key>()(e);
|
||||
}
|
||||
|
||||
template<typename Key, typename Env>
|
||||
typename proto::result_of::env_var<Env const &, Key>::type env_var(Env const &e)
|
||||
{
|
||||
return functional::env_var<Key>()(e);
|
||||
}
|
||||
|
||||
namespace envns_
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// env operator,
|
||||
template<typename T, typename T1, typename V1>
|
||||
inline typename disable_if_c<
|
||||
is_const<T>::value
|
||||
, env<T1, V1, BOOST_PROTO_UNCVREF(typename result_of::as_env<T &>::type)>
|
||||
>::type const operator,(T &t, env<T1, V1> const &head)
|
||||
{
|
||||
return env<T1, V1, BOOST_PROTO_UNCVREF(typename result_of::as_env<T &>::type)>(
|
||||
head[T1()]
|
||||
, proto::as_env(t)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T, typename T1, typename V1>
|
||||
inline env<T1, V1, BOOST_PROTO_UNCVREF(typename result_of::as_env<T const &>::type)> const
|
||||
operator,(T const &t, env<T1, V1> const &head)
|
||||
{
|
||||
return env<T1, V1, BOOST_PROTO_UNCVREF(typename result_of::as_env<T const &>::type)>(
|
||||
head[T1()]
|
||||
, proto::as_env(t)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// _env_var
|
||||
template<typename Key>
|
||||
struct _env_var
|
||||
: proto::transform<_env_var<Key> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename impl::data::template lookup<Key>::type result_type;
|
||||
BOOST_MPL_ASSERT_NOT((is_same<result_type, key_not_found>)); // lookup failed
|
||||
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::data::template lookup<Key>::const_reference)
|
||||
operator ()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return d[Key()];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct _env
|
||||
: transform<_env>
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef Data result_type;
|
||||
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::data_param)
|
||||
operator ()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return d;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Key>
|
||||
struct is_callable<_env_var<Key> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Key>
|
||||
struct is_callable<functional::has_env_var<Key> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Key>
|
||||
struct is_callable<functional::env_var<Key> >
|
||||
: mpl::true_
|
||||
{};
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,250 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file fold.hpp
|
||||
/// Contains definition of the fold<> and reverse_fold<> transforms.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_FOLD_HPP_EAN_11_04_2007
|
||||
#define BOOST_PROTO_TRANSFORM_FOLD_HPP_EAN_11_04_2007
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/fusion/include/fold.hpp>
|
||||
#include <boost/fusion/include/reverse_fold.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/when.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Transform, typename Data>
|
||||
struct as_callable
|
||||
{
|
||||
as_callable(Data d)
|
||||
: d_(d)
|
||||
{}
|
||||
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename State, typename Expr>
|
||||
struct result<This(State, Expr)>
|
||||
{
|
||||
typedef
|
||||
typename when<_, Transform>::template impl<Expr, State, Data>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
template<typename State, typename Expr>
|
||||
typename when<_, Transform>::template impl<Expr &, State const &, Data>::result_type
|
||||
operator ()(State const &s, Expr &e) const
|
||||
{
|
||||
return typename when<_, Transform>::template impl<Expr &, State const &, Data>()(e, s, this->d_);
|
||||
}
|
||||
|
||||
private:
|
||||
Data d_;
|
||||
};
|
||||
|
||||
template<
|
||||
typename State0
|
||||
, typename Fun
|
||||
, typename Expr
|
||||
, typename State
|
||||
, typename Data
|
||||
, long Arity = arity_of<Expr>::value
|
||||
>
|
||||
struct fold_impl
|
||||
{};
|
||||
|
||||
template<
|
||||
typename State0
|
||||
, typename Fun
|
||||
, typename Expr
|
||||
, typename State
|
||||
, typename Data
|
||||
, long Arity = arity_of<Expr>::value
|
||||
>
|
||||
struct reverse_fold_impl
|
||||
{};
|
||||
|
||||
#include <boost/proto/transform/detail/fold_impl.hpp>
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief A PrimitiveTransform that invokes the <tt>fusion::fold\<\></tt>
|
||||
/// algorithm to accumulate
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct fold : transform<fold<Sequence, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
/// \brief A Fusion sequence.
|
||||
typedef
|
||||
typename remove_reference<
|
||||
typename when<_, Sequence>::template impl<Expr, State, Data>::result_type
|
||||
>::type
|
||||
sequence;
|
||||
|
||||
/// \brief An initial state for the fold.
|
||||
typedef
|
||||
typename remove_reference<
|
||||
typename when<_, State0>::template impl<Expr, State, Data>::result_type
|
||||
>::type
|
||||
state0;
|
||||
|
||||
/// \brief <tt>fun(d)(e,s) == when\<_,Fun\>()(e,s,d)</tt>
|
||||
typedef
|
||||
detail::as_callable<Fun, Data>
|
||||
fun;
|
||||
|
||||
typedef
|
||||
typename fusion::result_of::fold<
|
||||
sequence
|
||||
, state0
|
||||
, fun
|
||||
>::type
|
||||
result_type;
|
||||
|
||||
/// Let \c seq be <tt>when\<_, Sequence\>()(e, s, d)</tt>, let
|
||||
/// \c state0 be <tt>when\<_, State0\>()(e, s, d)</tt>, and
|
||||
/// let \c fun(d) be an object such that <tt>fun(d)(e, s)</tt>
|
||||
/// is equivalent to <tt>when\<_, Fun\>()(e, s, d)</tt>. Then, this
|
||||
/// function returns <tt>fusion::fold(seq, state0, fun(d))</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename when<_, Sequence>::template impl<Expr, State, Data> seq;
|
||||
detail::as_callable<Fun, Data> f(d);
|
||||
return fusion::fold(
|
||||
seq(e, s, d)
|
||||
, typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, f
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that is the same as the
|
||||
/// <tt>fold\<\></tt> transform, except that it folds
|
||||
/// back-to-front instead of front-to-back.
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct reverse_fold : transform<reverse_fold<Sequence, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
/// \brief A Fusion sequence.
|
||||
typedef
|
||||
typename remove_reference<
|
||||
typename when<_, Sequence>::template impl<Expr, State, Data>::result_type
|
||||
>::type
|
||||
sequence;
|
||||
|
||||
/// \brief An initial state for the fold.
|
||||
typedef
|
||||
typename remove_reference<
|
||||
typename when<_, State0>::template impl<Expr, State, Data>::result_type
|
||||
>::type
|
||||
state0;
|
||||
|
||||
/// \brief <tt>fun(d)(e,s) == when\<_,Fun\>()(e,s,d)</tt>
|
||||
typedef
|
||||
detail::as_callable<Fun, Data>
|
||||
fun;
|
||||
|
||||
typedef
|
||||
typename fusion::result_of::reverse_fold<
|
||||
sequence
|
||||
, state0
|
||||
, fun
|
||||
>::type
|
||||
result_type;
|
||||
|
||||
/// Let \c seq be <tt>when\<_, Sequence\>()(e, s, d)</tt>, let
|
||||
/// \c state0 be <tt>when\<_, State0\>()(e, s, d)</tt>, and
|
||||
/// let \c fun(d) be an object such that <tt>fun(d)(e, s)</tt>
|
||||
/// is equivalent to <tt>when\<_, Fun\>()(e, s, d)</tt>. Then, this
|
||||
/// function returns <tt>fusion::fold(seq, state0, fun(d))</tt>.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename when<_, Sequence>::template impl<Expr, State, Data> seq;
|
||||
detail::as_callable<Fun, Data> f(d);
|
||||
return fusion::reverse_fold(
|
||||
seq(e, s, d)
|
||||
, typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d)
|
||||
, f
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// This specialization is only for improved compile-time performance
|
||||
// in the commom case when the Sequence transform is \c proto::_.
|
||||
//
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename State0, typename Fun>
|
||||
struct fold<_, State0, Fun> : transform<fold<_, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: detail::fold_impl<State0, Fun, Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
// This specialization is only for improved compile-time performance
|
||||
// in the commom case when the Sequence transform is \c proto::_.
|
||||
//
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename State0, typename Fun>
|
||||
struct reverse_fold<_, State0, Fun> : transform<reverse_fold<_, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: detail::reverse_fold_impl<State0, Fun, Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Sequence, typename State, typename Fun>
|
||||
struct is_callable<fold<Sequence, State, Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Sequence, typename State, typename Fun>
|
||||
struct is_callable<reverse_fold<Sequence, State, Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,182 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file fold_tree.hpp
|
||||
/// Contains definition of the fold_tree<> and reverse_fold_tree<> transforms.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_FOLD_TREE_HPP_EAN_11_05_2007
|
||||
#define BOOST_PROTO_TRANSFORM_FOLD_TREE_HPP_EAN_11_05_2007
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/matches.hpp>
|
||||
#include <boost/proto/transform/fold.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Tag>
|
||||
struct has_tag
|
||||
{
|
||||
template<typename Expr, typename State, typename Data, typename EnableIf = Tag>
|
||||
struct impl
|
||||
{
|
||||
typedef mpl::false_ result_type;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr, State, Data, typename Expr::proto_tag>
|
||||
{
|
||||
typedef mpl::true_ result_type;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr &, State, Data, typename Expr::proto_tag>
|
||||
{
|
||||
typedef mpl::true_ result_type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Fun>
|
||||
struct fold_tree_
|
||||
: if_<has_tag<Tag>, fold<_, _state, fold_tree_<Tag, Fun> >, Fun>
|
||||
{};
|
||||
|
||||
template<typename Tag, typename Fun>
|
||||
struct reverse_fold_tree_
|
||||
: if_<has_tag<Tag>, reverse_fold<_, _state, reverse_fold_tree_<Tag, Fun> >, Fun>
|
||||
{};
|
||||
}
|
||||
|
||||
/// \brief A PrimitiveTransform that recursively applies the
|
||||
/// <tt>fold\<\></tt> transform to sub-trees that all share a common
|
||||
/// tag type.
|
||||
///
|
||||
/// <tt>fold_tree\<\></tt> is useful for flattening trees into lists;
|
||||
/// for example, you might use <tt>fold_tree\<\></tt> to flatten an
|
||||
/// expression tree like <tt>a | b | c</tt> into a Fusion list like
|
||||
/// <tt>cons(c, cons(b, cons(a)))</tt>.
|
||||
///
|
||||
/// <tt>fold_tree\<\></tt> is easily understood in terms of a
|
||||
/// <tt>recurse_if_\<\></tt> helper, defined as follows:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Tag, typename Fun>
|
||||
/// struct recurse_if_
|
||||
/// : if_<
|
||||
/// // If the current node has type "Tag" ...
|
||||
/// is_same<tag_of<_>, Tag>()
|
||||
/// // ... recurse, otherwise ...
|
||||
/// , fold<_, _state, recurse_if_<Tag, Fun> >
|
||||
/// // ... apply the Fun transform.
|
||||
/// , Fun
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// With <tt>recurse_if_\<\></tt> as defined above,
|
||||
/// <tt>fold_tree\<Sequence, State0, Fun\>()(e, s, d)</tt> is
|
||||
/// equivalent to
|
||||
/// <tt>fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(e, s, d).</tt>
|
||||
/// It has the effect of folding a tree front-to-back, recursing into
|
||||
/// child nodes that share a tag type with the parent node.
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct fold_tree
|
||||
: transform<fold_tree<Sequence, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr &, State, Data>
|
||||
: fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr &, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that recursively applies the
|
||||
/// <tt>reverse_fold\<\></tt> transform to sub-trees that all share
|
||||
/// a common tag type.
|
||||
///
|
||||
/// <tt>reverse_fold_tree\<\></tt> is useful for flattening trees into
|
||||
/// lists; for example, you might use <tt>reverse_fold_tree\<\></tt> to
|
||||
/// flatten an expression tree like <tt>a | b | c</tt> into a Fusion list
|
||||
/// like <tt>cons(a, cons(b, cons(c)))</tt>.
|
||||
///
|
||||
/// <tt>reverse_fold_tree\<\></tt> is easily understood in terms of a
|
||||
/// <tt>recurse_if_\<\></tt> helper, defined as follows:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Tag, typename Fun>
|
||||
/// struct recurse_if_
|
||||
/// : if_<
|
||||
/// // If the current node has type "Tag" ...
|
||||
/// is_same<tag_of<_>, Tag>()
|
||||
/// // ... recurse, otherwise ...
|
||||
/// , reverse_fold<_, _state, recurse_if_<Tag, Fun> >
|
||||
/// // ... apply the Fun transform.
|
||||
/// , Fun
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// With <tt>recurse_if_\<\></tt> as defined above,
|
||||
/// <tt>reverse_fold_tree\<Sequence, State0, Fun\>()(e, s, d)</tt> is
|
||||
/// equivalent to
|
||||
/// <tt>reverse_fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(e, s, d).</tt>
|
||||
/// It has the effect of folding a tree back-to-front, recursing into
|
||||
/// child nodes that share a tag type with the parent node.
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct reverse_fold_tree
|
||||
: transform<reverse_fold_tree<Sequence, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: reverse_fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr &, State, Data>
|
||||
: reverse_fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr &, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct is_callable<fold_tree<Sequence, State0, Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct is_callable<reverse_fold_tree<Sequence, State0, Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,352 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file impl.hpp
|
||||
/// Contains definition of transform<> and transform_impl<> helpers.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_IMPL_HPP_EAN_04_03_2008
|
||||
#define BOOST_PROTO_TRANSFORM_IMPL_HPP_EAN_04_03_2008
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/detail/any.hpp>
|
||||
#include <boost/proto/detail/static_const.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace envns_
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct key_not_found
|
||||
{};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// empty_env
|
||||
struct empty_env
|
||||
{
|
||||
typedef void proto_environment_;
|
||||
|
||||
template<typename OtherTag, typename OtherValue = key_not_found>
|
||||
struct lookup
|
||||
{
|
||||
typedef OtherValue type;
|
||||
typedef
|
||||
typename add_reference<typename add_const<OtherValue>::type>::type
|
||||
const_reference;
|
||||
};
|
||||
|
||||
key_not_found operator[](detail::any) const
|
||||
{
|
||||
return key_not_found();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T const &at(detail::any, T const &t) const
|
||||
{
|
||||
return t;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// is_env
|
||||
template<typename T, typename Void>
|
||||
struct is_env
|
||||
: mpl::false_
|
||||
{};
|
||||
|
||||
template<typename T>
|
||||
struct is_env<T, typename T::proto_environment_>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
template<typename T>
|
||||
struct is_env<T &, void>
|
||||
: is_env<T>
|
||||
{};
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_TRANSFORM_(PrimitiveTransform, X) \
|
||||
BOOST_PROTO_CALLABLE() \
|
||||
typedef X proto_is_transform_; \
|
||||
typedef PrimitiveTransform transform_type; \
|
||||
\
|
||||
template<typename Sig> \
|
||||
struct result \
|
||||
{ \
|
||||
typedef typename boost::proto::detail::apply_transform<Sig>::result_type type; \
|
||||
}; \
|
||||
\
|
||||
template<typename Expr> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr &)>::result_type \
|
||||
operator ()(Expr &e) const \
|
||||
{ \
|
||||
boost::proto::empty_state s = 0; \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &)>::result_type \
|
||||
operator ()(Expr const &e) const \
|
||||
{ \
|
||||
boost::proto::empty_state s = 0; \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr &, State &)>::result_type \
|
||||
operator ()(Expr &e, State &s) const \
|
||||
{ \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr &, State &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &, State &)>::result_type \
|
||||
operator ()(Expr const &e, State &s) const \
|
||||
{ \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &, State &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr &, State const &)>::result_type \
|
||||
operator ()(Expr &e, State const &s) const \
|
||||
{ \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr &, State const &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &, State const &)>::result_type \
|
||||
operator ()(Expr const &e, State const &s) const \
|
||||
{ \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &, State const &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr &, State &, Data &)>::result_type \
|
||||
operator ()(Expr &e, State &s, Data &d) const \
|
||||
{ \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr &, State &, Data &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &, State &, Data &)>::result_type \
|
||||
operator ()(Expr const &e, State &s, Data &d) const \
|
||||
{ \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &, State &, Data &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr &, State const &, Data &)>::result_type \
|
||||
operator ()(Expr &e, State const &s, Data &d) const \
|
||||
{ \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr &, State const &, Data &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &, State const &, Data &)>::result_type \
|
||||
operator ()(Expr const &e, State const &s, Data &d) const \
|
||||
{ \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &, State const &, Data &)>()(e, s, d); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_TRANSFORM_(PrimitiveTransform, X) \
|
||||
BOOST_PROTO_CALLABLE() \
|
||||
typedef X proto_is_transform_; \
|
||||
typedef PrimitiveTransform transform_type; \
|
||||
\
|
||||
template<typename Sig> \
|
||||
struct result \
|
||||
{ \
|
||||
typedef typename boost::proto::detail::apply_transform<Sig>::result_type type; \
|
||||
}; \
|
||||
\
|
||||
template<typename Expr> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &)>::result_type \
|
||||
operator ()(Expr &&e) const \
|
||||
{ \
|
||||
boost::proto::empty_state s = 0; \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &, State const &)>::result_type \
|
||||
operator ()(Expr &&e, State &&s) const \
|
||||
{ \
|
||||
boost::proto::empty_env d; \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &, State const &)>()(e, s, d); \
|
||||
} \
|
||||
\
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
BOOST_FORCEINLINE \
|
||||
typename boost::proto::detail::apply_transform<transform_type(Expr const &, State const &, Data const &)>::result_type \
|
||||
operator ()(Expr &&e, State &&s, Data &&d) const \
|
||||
{ \
|
||||
return boost::proto::detail::apply_transform<transform_type(Expr const &, State const &, Data const &)>()(e, s, d); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_PROTO_TRANSFORM(PrimitiveTransform) \
|
||||
BOOST_PROTO_TRANSFORM_(PrimitiveTransform, void) \
|
||||
/**/
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename Sig>
|
||||
struct apply_transform;
|
||||
|
||||
template<typename PrimitiveTransform, typename Expr>
|
||||
struct apply_transform<PrimitiveTransform(Expr)>
|
||||
: PrimitiveTransform::template impl<Expr, empty_state, empty_env>
|
||||
{};
|
||||
|
||||
template<typename PrimitiveTransform, typename Expr, typename State>
|
||||
struct apply_transform<PrimitiveTransform(Expr, State)>
|
||||
: PrimitiveTransform::template impl<Expr, State, empty_env>
|
||||
{};
|
||||
|
||||
template<typename PrimitiveTransform, typename Expr, typename State, typename Data>
|
||||
struct apply_transform<PrimitiveTransform(Expr, State, Data)>
|
||||
: PrimitiveTransform::template impl<Expr, State, Data>
|
||||
{};
|
||||
}
|
||||
|
||||
template<typename PrimitiveTransform, typename X>
|
||||
struct transform
|
||||
{
|
||||
BOOST_PROTO_TRANSFORM_(PrimitiveTransform, X)
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl
|
||||
{
|
||||
typedef Expr const expr;
|
||||
typedef Expr const &expr_param;
|
||||
typedef State const state;
|
||||
typedef State const &state_param;
|
||||
typedef Data const data;
|
||||
typedef Data const &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr &, State, Data>
|
||||
{
|
||||
typedef Expr expr;
|
||||
typedef Expr &expr_param;
|
||||
typedef State const state;
|
||||
typedef State const &state_param;
|
||||
typedef Data const data;
|
||||
typedef Data const &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr, State &, Data>
|
||||
{
|
||||
typedef Expr const expr;
|
||||
typedef Expr const &expr_param;
|
||||
typedef State state;
|
||||
typedef State &state_param;
|
||||
typedef Data const data;
|
||||
typedef Data const &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr, State, Data &>
|
||||
{
|
||||
typedef Expr const expr;
|
||||
typedef Expr const &expr_param;
|
||||
typedef State const state;
|
||||
typedef State const &state_param;
|
||||
typedef Data data;
|
||||
typedef Data &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr &, State &, Data>
|
||||
{
|
||||
typedef Expr expr;
|
||||
typedef Expr &expr_param;
|
||||
typedef State state;
|
||||
typedef State &state_param;
|
||||
typedef Data const data;
|
||||
typedef Data const &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr &, State, Data &>
|
||||
{
|
||||
typedef Expr expr;
|
||||
typedef Expr &expr_param;
|
||||
typedef State const state;
|
||||
typedef State const &state_param;
|
||||
typedef Data data;
|
||||
typedef Data &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr, State &, Data &>
|
||||
{
|
||||
typedef Expr const expr;
|
||||
typedef Expr const &expr_param;
|
||||
typedef State state;
|
||||
typedef State &state_param;
|
||||
typedef Data data;
|
||||
typedef Data &data_param;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct transform_impl<Expr &, State &, Data &>
|
||||
{
|
||||
typedef Expr expr;
|
||||
typedef Expr &expr_param;
|
||||
typedef State state;
|
||||
typedef State &state_param;
|
||||
typedef Data data;
|
||||
typedef Data &data_param;
|
||||
};
|
||||
|
||||
}} // namespace boost::proto
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file integral_c.hpp
|
||||
/// Contains definition of the integral_c transform and friends.
|
||||
//
|
||||
// Copyright 2011 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_INTEGRAL_C_HPP_EAN_04_28_2011
|
||||
#define BOOST_PROTO_TRANSFORM_INTEGRAL_C_HPP_EAN_04_28_2011
|
||||
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
|
||||
/// \brief A PrimitiveTransform that returns a specified
|
||||
/// integral constant
|
||||
///
|
||||
template<typename T, T I>
|
||||
struct integral_c : transform<integral_c<T, I> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef T result_type;
|
||||
|
||||
/// \return \c I
|
||||
/// \throw nothrow
|
||||
T operator()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return I;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns a specified
|
||||
/// char
|
||||
///
|
||||
template<char I>
|
||||
struct char_
|
||||
: integral_c<char, I>
|
||||
{};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns a specified
|
||||
/// int
|
||||
///
|
||||
template<int I>
|
||||
struct int_
|
||||
: integral_c<int, I>
|
||||
{};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns a specified
|
||||
/// long
|
||||
///
|
||||
template<long I>
|
||||
struct long_
|
||||
: integral_c<long, I>
|
||||
{};
|
||||
|
||||
/// \brief A PrimitiveTransform that returns a specified
|
||||
/// std::size_t
|
||||
///
|
||||
template<std::size_t I>
|
||||
struct size_t
|
||||
: integral_c<std::size_t, I>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename T, T I>
|
||||
struct is_callable<integral_c<T, I> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<char I>
|
||||
struct is_callable<char_<I> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<int I>
|
||||
struct is_callable<int_<I> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<long I>
|
||||
struct is_callable<long_<I> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<std::size_t I>
|
||||
struct is_callable<size_t<I> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file lazy.hpp
|
||||
/// Contains definition of the lazy<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_LAZY_HPP_EAN_12_02_2007
|
||||
#define BOOST_PROTO_TRANSFORM_LAZY_HPP_EAN_12_02_2007
|
||||
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/transform/make.hpp>
|
||||
#include <boost/proto/transform/call.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/detail/pack.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
/// \brief A PrimitiveTransform that uses <tt>make\<\></tt> to build
|
||||
/// a CallableTransform, and then uses <tt>call\<\></tt> to apply it.
|
||||
///
|
||||
/// <tt>lazy\<\></tt> is useful as a higher-order transform, when the
|
||||
/// transform to be applied depends on the current state of the
|
||||
/// transformation. The invocation of the <tt>make\<\></tt> transform
|
||||
/// evaluates any nested transforms, and the resulting type is treated
|
||||
/// as a CallableTransform, which is evaluated with <tt>call\<\></tt>.
|
||||
template<typename Object>
|
||||
struct lazy : transform<lazy<Object> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Fun>
|
||||
struct lazy<detail::msvc_fun_workaround<Fun> >
|
||||
: lazy<Fun>
|
||||
{};
|
||||
|
||||
#include <boost/proto/transform/detail/lazy.hpp>
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Object>
|
||||
struct is_callable<lazy<Object> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,284 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file make.hpp
|
||||
/// Contains definition of the make<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_MAKE_HPP_EAN_12_02_2007
|
||||
#define BOOST_PROTO_TRANSFORM_MAKE_HPP_EAN_12_02_2007
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/selection/max.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/aux_/has_type.hpp>
|
||||
#include <boost/proto/detail/template_arity.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/args.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/detail/pack.hpp>
|
||||
#include <boost/proto/detail/as_lvalue.hpp>
|
||||
#include <boost/proto/detail/ignore_unused.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct is_applyable
|
||||
: mpl::and_<is_callable<T>, is_transform<T> >
|
||||
{};
|
||||
|
||||
template<typename T, bool HasType = mpl::aux::has_type<T>::value>
|
||||
struct nested_type
|
||||
{
|
||||
typedef typename T::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct nested_type<T, false>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T, bool Applied>
|
||||
struct nested_type_if
|
||||
{
|
||||
typedef T type;
|
||||
static bool const applied = false;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct nested_type_if<T, true>
|
||||
: nested_type<T>
|
||||
{
|
||||
static bool const applied = true;
|
||||
};
|
||||
|
||||
template<
|
||||
typename R
|
||||
, typename Expr, typename State, typename Data
|
||||
BOOST_PROTO_TEMPLATE_ARITY_PARAM(long Arity = detail::template_arity<R>::value)
|
||||
>
|
||||
struct make_
|
||||
{
|
||||
typedef R type;
|
||||
static bool const applied = false;
|
||||
};
|
||||
|
||||
template<
|
||||
typename R
|
||||
, typename Expr, typename State, typename Data
|
||||
, bool IsApplyable = is_applyable<R>::value
|
||||
>
|
||||
struct make_if_
|
||||
: make_<R, Expr, State, Data>
|
||||
{};
|
||||
|
||||
template<typename R, typename Expr, typename State, typename Data>
|
||||
struct make_if_<R, Expr, State, Data, true>
|
||||
: uncvref<typename when<_, R>::template impl<Expr, State, Data>::result_type>
|
||||
{
|
||||
static bool const applied = true;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0)
|
||||
// work around GCC bug
|
||||
template<typename Tag, typename Args, long N, typename Expr, typename State, typename Data>
|
||||
struct make_if_<proto::expr<Tag, Args, N>, Expr, State, Data, false>
|
||||
{
|
||||
typedef proto::expr<Tag, Args, N> type;
|
||||
static bool const applied = false;
|
||||
};
|
||||
|
||||
// work around GCC bug
|
||||
template<typename Tag, typename Args, long N, typename Expr, typename State, typename Data>
|
||||
struct make_if_<proto::basic_expr<Tag, Args, N>, Expr, State, Data, false>
|
||||
{
|
||||
typedef proto::basic_expr<Tag, Args, N> type;
|
||||
static bool const applied = false;
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename Type, bool IsAggregate = detail::is_aggregate_<Type>::value>
|
||||
struct construct_
|
||||
{
|
||||
typedef Type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()() const
|
||||
{
|
||||
return Type();
|
||||
}
|
||||
|
||||
// Other overloads generated by the preprocessor
|
||||
#include <boost/proto/transform/detail/construct_funop.hpp>
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
struct construct_<Type, true>
|
||||
{
|
||||
typedef Type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()() const
|
||||
{
|
||||
return Type();
|
||||
}
|
||||
|
||||
// Other overloads generated by the preprocessor
|
||||
#include <boost/proto/transform/detail/construct_pod_funop.hpp>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/// \brief A PrimitiveTransform which prevents another PrimitiveTransform
|
||||
/// from being applied in an \c ObjectTransform.
|
||||
///
|
||||
/// When building higher order transforms with <tt>make\<\></tt> or
|
||||
/// <tt>lazy\<\></tt>, you sometimes would like to build types that
|
||||
/// are parameterized with Proto transforms. In such lambda-style
|
||||
/// transforms, Proto will unhelpfully find all nested transforms
|
||||
/// and apply them, even if you don't want them to be applied. Consider
|
||||
/// the following transform, which will replace the \c _ in
|
||||
/// <tt>Bar<_>()</tt> with <tt>proto::terminal\<int\>::type</tt>:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename T>
|
||||
/// struct Bar
|
||||
/// {};
|
||||
///
|
||||
/// struct Foo
|
||||
/// : proto::when<_, Bar<_>() >
|
||||
/// {};
|
||||
///
|
||||
/// proto::terminal<int>::type i = {0};
|
||||
///
|
||||
/// int main()
|
||||
/// {
|
||||
/// Foo()(i);
|
||||
/// std::cout << typeid(Foo()(i)).name() << std::endl;
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// If you actually wanted to default-construct an object of type
|
||||
/// <tt>Bar\<_\></tt>, you would have to protect the \c _ to prevent
|
||||
/// it from being applied. You can use <tt>proto::protect\<\></tt>
|
||||
/// as follows:
|
||||
///
|
||||
/// \code
|
||||
/// // OK: replace anything with Bar<_>()
|
||||
/// struct Foo
|
||||
/// : proto::when<_, Bar<protect<_> >() >
|
||||
/// {};
|
||||
/// \endcode
|
||||
template<typename PrimitiveTransform>
|
||||
struct protect : transform<protect<PrimitiveTransform> >
|
||||
{
|
||||
template<typename, typename, typename>
|
||||
struct impl
|
||||
{
|
||||
typedef PrimitiveTransform result_type;
|
||||
};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform which computes a type by evaluating any
|
||||
/// nested transforms and then constructs an object of that type.
|
||||
///
|
||||
/// The <tt>make\<\></tt> transform checks to see if \c Object is a template.
|
||||
/// If it is, the template type is disassembled to find nested transforms.
|
||||
/// Proto considers the following types to represent transforms:
|
||||
///
|
||||
/// \li Function types
|
||||
/// \li Function pointer types
|
||||
/// \li Types for which <tt>proto::is_callable\< type \>::value</tt> is \c true
|
||||
///
|
||||
/// <tt>boost::result_of\<make\<T\<X0,X1,...\> \>(Expr, State, Data)\>::type</tt>
|
||||
/// is evaluated as follows. For each \c X in <tt>X0,X1,...</tt>, do:
|
||||
///
|
||||
/// \li If \c X is a template like <tt>U\<Y0,Y1,...\></tt>, then let <tt>X'</tt>
|
||||
/// be <tt>boost::result_of\<make\<U\<Y0,Y1,...\> \>(Expr, State, Data)\>::type</tt>
|
||||
/// (which evaluates this procedure recursively). Note whether any
|
||||
/// substitutions took place during this operation.
|
||||
/// \li Otherwise, if \c X is a transform, then let <tt>X'</tt> be
|
||||
/// <tt>boost::result_of\<when\<_, X\>(Expr, State, Data)\>::type</tt>.
|
||||
/// Note that a substitution took place.
|
||||
/// \li Otherwise, let <tt>X'</tt> be \c X, and note that no substitution
|
||||
/// took place.
|
||||
/// \li If any substitutions took place in any of the above steps and
|
||||
/// <tt>T\<X0',X1',...\></tt> has a nested <tt>::type</tt> typedef,
|
||||
/// the result type is <tt>T\<X0',X1',...\>::type</tt>.
|
||||
/// \li Otherwise, the result type is <tt>T\<X0',X1',...\></tt>.
|
||||
///
|
||||
/// Note that <tt>when\<\></tt> is implemented in terms of <tt>call\<\></tt>
|
||||
/// and <tt>make\<\></tt>, so the above procedure is evaluated recursively.
|
||||
template<typename Object>
|
||||
struct make : transform<make<Object> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename detail::make_if_<Object, Expr, State, Data>::type result_type;
|
||||
|
||||
/// \return <tt>result_type()</tt>
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Fun>
|
||||
struct make<detail::msvc_fun_workaround<Fun> >
|
||||
: make<Fun>
|
||||
{};
|
||||
|
||||
// Other specializations generated by the preprocessor.
|
||||
#include <boost/proto/transform/detail/make.hpp>
|
||||
#include <boost/proto/transform/detail/make_gcc_workaround.hpp>
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Object>
|
||||
struct is_callable<make<Object> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename PrimitiveTransform>
|
||||
struct is_callable<protect<PrimitiveTransform> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pass_through.hpp
|
||||
///
|
||||
/// Definition of the pass_through transform, which is the default transform
|
||||
/// of all of the expression generator metafunctions such as unary_plus<>, plus<>
|
||||
/// and nary_expr<>.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_PASS_THROUGH_HPP_EAN_12_26_2006
|
||||
#define BOOST_PROTO_TRANSFORM_PASS_THROUGH_HPP_EAN_12_26_2006
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/args.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/detail/ignore_unused.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<
|
||||
typename Grammar
|
||||
, typename Domain
|
||||
, typename Expr
|
||||
, typename State
|
||||
, typename Data
|
||||
, long Arity = arity_of<Expr>::value
|
||||
>
|
||||
struct pass_through_impl
|
||||
{};
|
||||
|
||||
#include <boost/proto/transform/detail/pass_through_impl.hpp>
|
||||
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 0>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef Expr result_type;
|
||||
|
||||
/// \param e An expression
|
||||
/// \return \c e
|
||||
/// \throw nothrow
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename pass_through_impl::expr_param)
|
||||
operator()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param
|
||||
, typename pass_through_impl::data_param
|
||||
) const
|
||||
{
|
||||
return e;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief A PrimitiveTransform that transforms the child expressions
|
||||
/// of an expression node according to the corresponding children of
|
||||
/// a Grammar.
|
||||
///
|
||||
/// Given a Grammar such as <tt>plus\<T0, T1\></tt>, an expression type
|
||||
/// that matches the grammar such as <tt>plus\<E0, E1\>::type</tt>, a
|
||||
/// state \c S and a data \c V, the result of applying the
|
||||
/// <tt>pass_through\<plus\<T0, T1\> \></tt> transform is:
|
||||
///
|
||||
/// \code
|
||||
/// plus<
|
||||
/// T0::result<T0(E0, S, V)>::type
|
||||
/// , T1::result<T1(E1, S, V)>::type
|
||||
/// >::type
|
||||
/// \endcode
|
||||
///
|
||||
/// The above demonstrates how child transforms and child expressions
|
||||
/// are applied pairwise, and how the results are reassembled into a new
|
||||
/// expression node with the same tag type as the original.
|
||||
///
|
||||
/// The explicit use of <tt>pass_through\<\></tt> is not usually needed,
|
||||
/// since the expression generator metafunctions such as
|
||||
/// <tt>plus\<\></tt> have <tt>pass_through\<\></tt> as their default
|
||||
/// transform. So, for instance, these are equivalent:
|
||||
///
|
||||
/// \code
|
||||
/// // Within a grammar definition, these are equivalent:
|
||||
/// when< plus<X, Y>, pass_through< plus<X, Y> > >
|
||||
/// when< plus<X, Y>, plus<X, Y> >
|
||||
/// when< plus<X, Y> > // because of when<class X, class Y=X>
|
||||
/// plus<X, Y> // because plus<> is both a
|
||||
/// // grammar and a transform
|
||||
/// \endcode
|
||||
///
|
||||
/// For example, consider the following transform that promotes all
|
||||
/// \c float terminals in an expression to \c double.
|
||||
///
|
||||
/// \code
|
||||
/// // This transform finds all float terminals in an expression and promotes
|
||||
/// // them to doubles.
|
||||
/// struct Promote
|
||||
/// : or_<
|
||||
/// when<terminal<float>, terminal<double>::type(_value) >
|
||||
/// // terminal<>'s default transform is a no-op:
|
||||
/// , terminal<_>
|
||||
/// // nary_expr<> has a pass_through<> transform:
|
||||
/// , nary_expr<_, vararg<Promote> >
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
template<typename Grammar, typename Domain /* = deduce_domain*/>
|
||||
struct pass_through
|
||||
: transform<pass_through<Grammar, Domain> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: detail::pass_through_impl<Grammar, Domain, Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Grammar, typename Domain>
|
||||
struct is_callable<pass_through<Grammar, Domain> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}} // namespace boost::proto
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,267 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file when.hpp
|
||||
/// Definition of when transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_WHEN_HPP_EAN_10_29_2007
|
||||
#define BOOST_PROTO_TRANSFORM_WHEN_HPP_EAN_10_29_2007
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/map.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/transform/call.hpp>
|
||||
#include <boost/proto/transform/make.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/env.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Grammar, typename R, typename Fun>
|
||||
struct when_impl
|
||||
: transform<when<Grammar, Fun> >
|
||||
{
|
||||
typedef Grammar first;
|
||||
typedef Fun second;
|
||||
typedef typename Grammar::proto_grammar proto_grammar;
|
||||
|
||||
// Note: do not evaluate is_callable<R> in this scope.
|
||||
// R may be an incomplete type at this point.
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl : transform_impl<Expr, State, Data>
|
||||
{
|
||||
// OK to evaluate is_callable<R> here. R should be compete by now.
|
||||
typedef
|
||||
typename mpl::if_c<
|
||||
is_callable<R>::value
|
||||
, proto::call<Fun> // "R" is a function to call
|
||||
, proto::make<Fun> // "R" is an object to construct
|
||||
>::type
|
||||
which;
|
||||
|
||||
typedef typename which::template impl<Expr, State, Data>::result_type result_type;
|
||||
|
||||
/// Evaluate <tt>R(A0,A1,...)</tt> as a transform either with
|
||||
/// <tt>call\<\></tt> or with <tt>make\<\></tt> depending on
|
||||
/// whether <tt>is_callable\<R\>::value</tt> is \c true or
|
||||
/// \c false.
|
||||
///
|
||||
/// \param e The current expression
|
||||
/// \param s The current state
|
||||
/// \param d An arbitrary data
|
||||
/// \pre <tt>matches\<Expr, Grammar\>::value</tt> is \c true
|
||||
/// \return <tt>which()(e, s, d)</tt>
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return typename which::template impl<Expr, State, Data>()(e, s, d);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/// \brief A grammar element and a PrimitiveTransform that associates
|
||||
/// a transform with the grammar.
|
||||
///
|
||||
/// Use <tt>when\<\></tt> to override a grammar's default transform
|
||||
/// with a custom transform. It is for used when composing larger
|
||||
/// transforms by associating smaller transforms with individual
|
||||
/// rules in your grammar, as in the following transform which
|
||||
/// counts the number of terminals in an expression.
|
||||
///
|
||||
/// \code
|
||||
/// // Count the terminals in an expression tree.
|
||||
/// // Must be invoked with initial state == mpl::int_<0>().
|
||||
/// struct CountLeaves
|
||||
/// : or_<
|
||||
/// when<terminal<_>, mpl::next<_state>()>
|
||||
/// , otherwise<fold<_, _state, CountLeaves> >
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// In <tt>when\<G, T\></tt>, when \c T is a class type it is a
|
||||
/// PrimitiveTransform and the following equivalencies hold:
|
||||
///
|
||||
/// <tt>boost::result_of\<when\<G,T\>(E,S,V)\>::type</tt> is the same as
|
||||
/// <tt>boost::result_of\<T(E,S,V)\>::type</tt>.
|
||||
///
|
||||
/// <tt>when\<G,T\>()(e,s,d)</tt> is the same as
|
||||
/// <tt>T()(e,s,d)</tt>.
|
||||
template<typename Grammar, typename PrimitiveTransform /*= Grammar*/>
|
||||
struct when
|
||||
: PrimitiveTransform
|
||||
{
|
||||
typedef Grammar first;
|
||||
typedef PrimitiveTransform second;
|
||||
typedef typename Grammar::proto_grammar proto_grammar;
|
||||
};
|
||||
|
||||
/// \brief A specialization that treats function pointer Transforms as
|
||||
/// if they were function type Transforms.
|
||||
///
|
||||
/// This specialization requires that \c Fun is actually a function type.
|
||||
///
|
||||
/// This specialization is required for nested transforms such as
|
||||
/// <tt>when\<G, T0(T1(_))\></tt>. In C++, functions that are used as
|
||||
/// parameters to other functions automatically decay to funtion
|
||||
/// pointer types. In other words, the type <tt>T0(T1(_))</tt> is
|
||||
/// indistinguishable from <tt>T0(T1(*)(_))</tt>. This specialization
|
||||
/// is required to handle these nested function pointer type transforms
|
||||
/// properly.
|
||||
template<typename Grammar, typename Fun>
|
||||
struct when<Grammar, Fun *>
|
||||
: when<Grammar, Fun>
|
||||
{};
|
||||
|
||||
/// \brief Syntactic sugar for <tt>when\<_, Fun\></tt>, for use
|
||||
/// in grammars to handle all the cases not yet handled.
|
||||
///
|
||||
/// Use <tt>otherwise\<T\></tt> in your grammars as a synonym for
|
||||
/// <tt>when\<_, T\></tt> as in the following transform which
|
||||
/// counts the number of terminals in an expression.
|
||||
///
|
||||
/// \code
|
||||
/// // Count the terminals in an expression tree.
|
||||
/// // Must be invoked with initial state == mpl::int_<0>().
|
||||
/// struct CountLeaves
|
||||
/// : or_<
|
||||
/// when<terminal<_>, mpl::next<_state>()>
|
||||
/// , otherwise<fold<_, _state, CountLeaves> >
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
template<typename Fun>
|
||||
struct otherwise
|
||||
: when<_, Fun>
|
||||
{};
|
||||
|
||||
namespace envns_
|
||||
{
|
||||
// Define the transforms global
|
||||
BOOST_PROTO_DEFINE_ENV_VAR(transforms_type, transforms);
|
||||
}
|
||||
|
||||
using envns_::transforms;
|
||||
|
||||
/// \brief This specialization uses the Data parameter as a collection
|
||||
/// of transforms that can be indexed by the specified rule.
|
||||
///
|
||||
/// Use <tt>when\<T, external_transform\></tt> in your code when you would like
|
||||
/// to define a grammar once and use it to evaluate expressions with
|
||||
/// many different sets of transforms. The transforms are found by
|
||||
/// using the Data parameter as a map from rules to transforms.
|
||||
///
|
||||
/// See \c action_map for an example.
|
||||
template<typename Grammar>
|
||||
struct when<Grammar, external_transform>
|
||||
: proto::transform<when<Grammar, external_transform> >
|
||||
{
|
||||
typedef Grammar first;
|
||||
typedef external_transform second;
|
||||
typedef typename Grammar::proto_grammar proto_grammar;
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: remove_reference<
|
||||
typename mpl::eval_if_c<
|
||||
proto::result_of::has_env_var<Data, transforms_type>::value
|
||||
, proto::result_of::env_var<Data, transforms_type>
|
||||
, proto::result_of::env_var<Data, data_type>
|
||||
>::type
|
||||
>::type::template when<Grammar>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief For defining a map of Rule/Transform pairs for use with
|
||||
/// <tt>when\<T, external_transform\></tt> to make transforms external to the grammar
|
||||
///
|
||||
/// The following code defines a grammar with a couple of external transforms.
|
||||
/// It also defines an action_map that maps from rules to transforms. It then
|
||||
/// passes that transforms map at the Data parameter to the grammar. In this way,
|
||||
/// the behavior of the grammar can be modified post-hoc by passing a different
|
||||
/// action_map.
|
||||
///
|
||||
/// \code
|
||||
/// struct int_terminal
|
||||
/// : proto::terminal<int>
|
||||
/// {};
|
||||
///
|
||||
/// struct char_terminal
|
||||
/// : proto::terminal<char>
|
||||
/// {};
|
||||
///
|
||||
/// struct my_grammar
|
||||
/// : proto::or_<
|
||||
/// proto::when< int_terminal, proto::external_transform >
|
||||
/// , proto::when< char_terminal, proto::external_transform >
|
||||
/// , proto::when<
|
||||
/// proto::plus< my_grammar, my_grammar >
|
||||
/// , proto::fold< _, int(), my_grammar >
|
||||
/// >
|
||||
/// >
|
||||
/// {};
|
||||
///
|
||||
/// struct my_transforms
|
||||
/// : proto::external_transforms<
|
||||
/// proto::when<int_terminal, print(proto::_value)>
|
||||
/// , proto::when<char_terminal, print(proto::_value)>
|
||||
/// >
|
||||
/// {};
|
||||
///
|
||||
/// proto::literal<int> i(1);
|
||||
/// proto::literal<char> c('a');
|
||||
/// my_transforms trx;
|
||||
///
|
||||
/// // Evaluate "i+c" using my_grammar with the specified transforms:
|
||||
/// my_grammar()(i + c, 0, trx);
|
||||
/// \endcode
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_LIMIT_MAP_SIZE, typename T, mpl::na)>
|
||||
struct external_transforms
|
||||
{
|
||||
typedef mpl::map<BOOST_PP_ENUM_PARAMS(BOOST_MPL_LIMIT_MAP_SIZE, T)> map_type;
|
||||
|
||||
template<typename Rule>
|
||||
struct when
|
||||
: proto::when<_, typename mpl::at<map_type, Rule>::type>
|
||||
{};
|
||||
};
|
||||
|
||||
// Other specializations of proto::when are generated by the preprocessor...
|
||||
#include <boost/proto/transform/detail/when.hpp>
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Grammar, typename Transform>
|
||||
struct is_callable<when<Grammar, Transform> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}} // namespace boost::proto
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user