mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
Removing phoenix-2 for good ( good bye I will miss you )
This commit is contained in:
@@ -110,12 +110,6 @@ namespace boost { namespace spirit { namespace lex
|
||||
state_setter(Actor const& actor)
|
||||
: actor_(actor) {}
|
||||
|
||||
// see explanation for this constructor at the end of this file
|
||||
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
state_setter(phoenix::actor<state_getter>, Actor const& actor)
|
||||
: actor_(actor) {}
|
||||
#endif
|
||||
|
||||
Actor actor_;
|
||||
};
|
||||
|
||||
@@ -190,12 +184,6 @@ namespace boost { namespace spirit { namespace lex
|
||||
value_setter(Actor const& actor)
|
||||
: actor_(actor) {}
|
||||
|
||||
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
// see explanation for this constructor at the end of this file
|
||||
value_setter(phoenix::actor<value_getter>, Actor const& actor)
|
||||
: actor_(actor) {}
|
||||
#endif
|
||||
|
||||
Actor actor_;
|
||||
};
|
||||
|
||||
@@ -281,81 +269,6 @@ namespace boost { namespace spirit { namespace lex
|
||||
#endif
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// The specialization of as_actor_base<> below is needed to convert all
|
||||
// occurrences of _state in places where it's used as a rvalue into the
|
||||
// proper Phoenix actor (spirit::state_getter) accessing the lexer state.
|
||||
template<>
|
||||
struct as_actor_base<actor<spirit::lex::state_context> >
|
||||
{
|
||||
typedef spirit::lex::state_getter type;
|
||||
|
||||
static spirit::lex::state_getter
|
||||
convert(actor<spirit::lex::state_context>)
|
||||
{
|
||||
return spirit::lex::state_getter();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// The specialization of as_composite<> below is needed to convert all
|
||||
// assignments to _state (places where it's used as a lvalue) into the
|
||||
// proper Phoenix actor (spirit::state_setter) allowing to change the
|
||||
// lexer state.
|
||||
template <typename RHS>
|
||||
struct as_composite<assign_eval, actor<spirit::lex::state_context>, RHS>
|
||||
{
|
||||
// For an assignment to _state (a spirit::state_context actor), this
|
||||
// specialization makes Phoenix's compose() function construct a
|
||||
// spirit::state_setter actor from 1. the LHS, a spirit::state_getter
|
||||
// actor (due to the specialization of as_actor_base<> above),
|
||||
// and 2. the RHS actor.
|
||||
// This is why spirit::state_setter needs a constructor which takes
|
||||
// a dummy spirit::state_getter as its first argument in addition
|
||||
// to its real, second argument (the RHS actor).
|
||||
typedef spirit::lex::state_setter<typename as_actor<RHS>::type> type;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// The specialization of as_actor_base<> below is needed to convert all
|
||||
// occurrences of _val in places where it's used as a rvalue into the
|
||||
// proper Phoenix actor (spirit::value_getter) accessing the token value.
|
||||
template<>
|
||||
struct as_actor_base<actor<spirit::lex::value_context> >
|
||||
{
|
||||
typedef spirit::lex::value_getter type;
|
||||
|
||||
static spirit::lex::value_getter
|
||||
convert(actor<spirit::lex::value_context>)
|
||||
{
|
||||
return spirit::lex::value_getter();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// The specialization of as_composite<> below is needed to convert all
|
||||
// assignments to _val (places where it's used as a lvalue) into the
|
||||
// proper Phoenix actor (spirit::value_setter) allowing to change the
|
||||
// token value.
|
||||
template <typename RHS>
|
||||
struct as_composite<assign_eval, actor<spirit::lex::value_context>, RHS>
|
||||
{
|
||||
// For an assignment to _val (a spirit::value_context actor), this
|
||||
// specialization makes Phoenix's compose() function construct a
|
||||
// spirit::value_setter actor from 1. the LHS, a spirit::value_getter
|
||||
// actor (due to the specialization of as_actor_base<> above),
|
||||
// and 2. the RHS actor.
|
||||
// This is why spirit::value_setter needs a constructor which takes
|
||||
// a dummy spirit::value_getter as its first argument in addition
|
||||
// to its real, second argument (the RHS actor).
|
||||
typedef spirit::lex::value_setter<typename as_actor<RHS>::type> type;
|
||||
};
|
||||
}}
|
||||
#endif
|
||||
|
||||
#undef SPIRIT_DECLARE_ARG
|
||||
#endif
|
||||
|
||||
@@ -82,7 +82,6 @@ namespace boost { namespace spirit { namespace lex
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(spirit)(lex)(value_setter)
|
||||
@@ -246,6 +245,4 @@ namespace boost { namespace phoenix
|
||||
{};
|
||||
}}
|
||||
|
||||
#endif // BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,37 +21,6 @@ namespace boost { namespace spirit { namespace lex
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
namespace boost { namespace spirit { namespace lex
|
||||
{
|
||||
namespace expression
|
||||
{
|
||||
template <typename Eval>
|
||||
struct less
|
||||
{
|
||||
typedef phoenix::actor<lex::less_type<Eval> > type;
|
||||
|
||||
static type make(Eval const & eval)
|
||||
{
|
||||
return lex::less_type<Eval>(eval);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename IdType, typename State>
|
||||
struct lookahead
|
||||
{
|
||||
typedef phoenix::actor<lex::lookahead_type<IdType, State> > type;
|
||||
|
||||
static type make(IdType const & id_type, State const & state)
|
||||
{
|
||||
return lex::lookahead_type<IdType, State>(id_type, state);
|
||||
}
|
||||
};
|
||||
}
|
||||
}}}
|
||||
|
||||
#else // BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(spirit)(lex)(less)
|
||||
@@ -130,6 +99,4 @@ namespace boost { namespace phoenix
|
||||
{};
|
||||
}}
|
||||
|
||||
#endif // BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2008 Joel de Guzman
|
||||
|
||||
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(BOOST_SPIRIT_PHOENIX_APRIL_11_2008_0850AM)
|
||||
#define BOOST_SPIRIT_PHOENIX_APRIL_11_2008_0850AM
|
||||
|
||||
#include <boost/spirit/home/phoenix/algorithm.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind.hpp>
|
||||
#include <boost/spirit/home/phoenix/container.hpp>
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/function.hpp>
|
||||
#include <boost/spirit/home/phoenix/fusion.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl.hpp>
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_ALGORITHM_HPP
|
||||
#define PHOENIX_ALGORITHM_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm/iteration.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm/querying.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm/transformation.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_BIND_HPP
|
||||
#define PHOENIX_BIND_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind/bind_function.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind/bind_function_object.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind/bind_member_function.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind/bind_member_variable.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,58 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_BIND_BIND_FUNCTION_HPP
|
||||
#define PHOENIX_BIND_BIND_FUNCTION_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/detail/function_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind/detail/function_ptr.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename RT>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<0>
|
||||
, detail::function_ptr<0, RT, RT(*)()>
|
||||
>::type>
|
||||
bind(RT(*f)())
|
||||
{
|
||||
typedef detail::function_ptr<0, RT, RT(*)()> fp_type;
|
||||
return compose<detail::function_eval<0> >(fp_type(f));
|
||||
}
|
||||
|
||||
template <typename RT, typename T0, typename A0>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::function_ptr<1, RT, RT(*)(T0)>
|
||||
, A0
|
||||
>::type>
|
||||
bind(RT(*f)(T0), A0 const& _0)
|
||||
{
|
||||
typedef detail::function_ptr<1, RT, RT(*)(T0)> fp_type;
|
||||
return compose<detail::function_eval<1> >(fp_type(f), _0);
|
||||
}
|
||||
|
||||
template <typename RT, typename T0, typename T1, typename A0, typename A1>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<2>
|
||||
, detail::function_ptr<2, RT, RT(*)(T0, T1)>
|
||||
, A0, A1
|
||||
>::type>
|
||||
bind(RT(*f)(T0, T1), A0 const& _0, A1 const& _1)
|
||||
{
|
||||
typedef detail::function_ptr<2, RT, RT(*)(T0, T1)> fp_type;
|
||||
return compose<detail::function_eval<2> >(fp_type(f), _0, _1);
|
||||
}
|
||||
|
||||
// Bring in the rest of the function binders
|
||||
#include <boost/spirit/home/phoenix/bind/detail/bind_function.hpp>
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_BIND_BIND_FUNCTION_OBJECT_HPP
|
||||
#define PHOENIX_BIND_BIND_FUNCTION_OBJECT_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/detail/function_eval.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename F>
|
||||
inline actor<typename as_composite<detail::function_eval<0>, F>::type>
|
||||
bind(F const& f)
|
||||
{
|
||||
return compose<detail::function_eval<0> >(f);
|
||||
}
|
||||
|
||||
template <typename F, typename A0>
|
||||
inline actor<typename as_composite<detail::function_eval<1>, F, A0>::type>
|
||||
bind(F const& f, A0 const& _0)
|
||||
{
|
||||
return compose<detail::function_eval<1> >(f, _0);
|
||||
}
|
||||
|
||||
template <typename F, typename A0, typename A1>
|
||||
inline actor<typename as_composite<detail::function_eval<2>, F, A0, A1>::type>
|
||||
bind(F const& f, A0 const& _0, A1 const& _1)
|
||||
{
|
||||
return compose<detail::function_eval<2> >(f, _0, _1);
|
||||
}
|
||||
|
||||
// Bring in the rest of the function object binders
|
||||
#include <boost/spirit/home/phoenix/bind/detail/bind_function_object.hpp>
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,77 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_BIND_BIND_MEMBER_FUNCTION_HPP
|
||||
#define PHOENIX_BIND_BIND_MEMBER_FUNCTION_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/detail/function_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/bind/detail/member_function_ptr.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename RT, typename ClassT, typename ClassA>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::member_function_ptr<0, RT, RT(ClassT::*)()>
|
||||
, ClassA
|
||||
>::type>
|
||||
bind(RT(ClassT::*f)(), ClassA const& obj)
|
||||
{
|
||||
typedef detail::member_function_ptr<0, RT, RT(ClassT::*)()> fp_type;
|
||||
return compose<detail::function_eval<1> >(fp_type(f), obj);
|
||||
}
|
||||
|
||||
template <typename RT, typename ClassT, typename ClassA>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::member_function_ptr<0, RT, RT(ClassT::*)() const>
|
||||
, ClassA
|
||||
>::type>
|
||||
bind(RT(ClassT::*f)() const, ClassA const& obj)
|
||||
{
|
||||
typedef detail::member_function_ptr<0, RT, RT(ClassT::*)() const> fp_type;
|
||||
return compose<detail::function_eval<1> >(fp_type(f), obj);
|
||||
}
|
||||
|
||||
template <typename RT, typename ClassT>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::member_function_ptr<0, RT, RT(ClassT::*)()>
|
||||
, actor<reference<ClassT> >
|
||||
>::type>
|
||||
bind(RT(ClassT::*f)(), ClassT& obj)
|
||||
{
|
||||
typedef detail::member_function_ptr<0, RT, RT(ClassT::*)()> fp_type;
|
||||
return compose<detail::function_eval<1> >(
|
||||
fp_type(f)
|
||||
, actor<reference<ClassT> >(reference<ClassT>(obj)));
|
||||
}
|
||||
|
||||
template <typename RT, typename ClassT>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::member_function_ptr<0, RT, RT(ClassT::*)() const>
|
||||
, actor<reference<ClassT> >
|
||||
>::type>
|
||||
bind(RT(ClassT::*f)() const, ClassT& obj)
|
||||
{
|
||||
typedef detail::member_function_ptr<0, RT, RT(ClassT::*)() const> fp_type;
|
||||
return compose<detail::function_eval<1> >(
|
||||
fp_type(f)
|
||||
, actor<reference<ClassT> >(reference<ClassT>(obj)));
|
||||
}
|
||||
|
||||
// Bring in the rest of the function binders
|
||||
#include <boost/spirit/home/phoenix/bind/detail/bind_member_function.hpp>
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,105 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP
|
||||
#define PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/detail/function_eval.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename RT, typename MP>
|
||||
struct member_variable
|
||||
{
|
||||
template <typename Class>
|
||||
struct result
|
||||
{
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_const<
|
||||
typename boost::remove_pointer<
|
||||
typename boost::remove_reference<Class>::type
|
||||
>::type
|
||||
>
|
||||
, const RT&
|
||||
, RT&
|
||||
>::type type;
|
||||
};
|
||||
|
||||
member_variable(MP mp)
|
||||
: mp(mp) {}
|
||||
|
||||
template <typename Class>
|
||||
RT& operator()(Class& obj) const
|
||||
{
|
||||
return obj.*mp;
|
||||
}
|
||||
|
||||
template <typename Class>
|
||||
RT& operator()(Class* obj) const
|
||||
{
|
||||
return obj->*mp;
|
||||
}
|
||||
|
||||
template <typename Class>
|
||||
RT const& operator()(Class const& obj) const
|
||||
{
|
||||
return obj.*mp;
|
||||
}
|
||||
|
||||
template <typename Class>
|
||||
RT const& operator()(Class const* obj) const
|
||||
{
|
||||
return obj->*mp;
|
||||
}
|
||||
|
||||
MP mp;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename RT, typename ClassT, typename ClassA>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::member_variable<RT, RT ClassT::*>
|
||||
, ClassA
|
||||
>::type>
|
||||
bind(RT ClassT::*mp, ClassA const& obj)
|
||||
{
|
||||
typedef detail::member_variable<RT, RT ClassT::*> mp_type;
|
||||
return compose<detail::function_eval<1> >(mp_type(mp), obj);
|
||||
}
|
||||
|
||||
template <typename RT, typename ClassT>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<1>
|
||||
, detail::member_variable<RT, RT ClassT::*>
|
||||
, actor<reference<ClassT> >
|
||||
>::type>
|
||||
bind(RT ClassT::*mp, ClassT& obj)
|
||||
{
|
||||
typedef detail::member_variable<RT, RT ClassT::*> mp_type;
|
||||
return compose<detail::function_eval<1> >(
|
||||
mp_type(mp)
|
||||
, actor<reference<ClassT> >(reference<ClassT>(obj)));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,53 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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(BOOST_PP_IS_ITERATING)
|
||||
#if !defined(PHOENIX_BIND_DETAIL_BIND_FUNCTION_HPP)
|
||||
#define PHOENIX_BIND_DETAIL_BIND_FUNCTION_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT), \
|
||||
"boost/spirit/home/phoenix/bind/detail/bind_function.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename RT
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename T)
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<N>
|
||||
, detail::function_ptr<N, RT, RT(*)(BOOST_PP_ENUM_PARAMS(N, T))>
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)
|
||||
>::type>
|
||||
bind(RT(*f)(BOOST_PP_ENUM_PARAMS(N, T))
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
typedef detail::function_ptr<
|
||||
N, RT, RT(*)(BOOST_PP_ENUM_PARAMS(N, T))> fp_type;
|
||||
return compose<detail::function_eval<N> >(
|
||||
fp_type(f), BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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(BOOST_PP_IS_ITERATING)
|
||||
#if !defined(PHOENIX_BIND_DETAIL_BIND_FUNCTION_OBJECT_HPP)
|
||||
#define PHOENIX_BIND_DETAIL_BIND_FUNCTION_OBJECT_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT), \
|
||||
"boost/spirit/home/phoenix/bind/detail/bind_function_object.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename F, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<typename as_composite<detail::function_eval<N>, F
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)>::type>
|
||||
bind(F const& f, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
return compose<detail::function_eval<N> >(f, BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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(BOOST_PP_IS_ITERATING)
|
||||
#if !defined(PHOENIX_BIND_DETAIL_BIND_MEMBER_FUNCTION_HPP)
|
||||
#define PHOENIX_BIND_DETAIL_BIND_MEMBER_FUNCTION_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT)), \
|
||||
"boost/spirit/home/phoenix/bind/detail/bind_member_function.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename RT
|
||||
, typename ClassT
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename T)
|
||||
, typename ClassA
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<BOOST_PP_INC(N)>
|
||||
, detail::member_function_ptr<N,
|
||||
RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T))>
|
||||
, ClassA, BOOST_PP_ENUM_PARAMS(N, A)
|
||||
>::type>
|
||||
bind(
|
||||
RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(N, T))
|
||||
, ClassA const& obj
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
typedef detail::member_function_ptr<
|
||||
N, RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T))> fp_type;
|
||||
return compose<detail::function_eval<BOOST_PP_INC(N)> >(
|
||||
fp_type(f), obj, BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
template <typename RT
|
||||
, typename ClassT
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename T)
|
||||
, typename ClassA
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<BOOST_PP_INC(N)>
|
||||
, detail::member_function_ptr<N,
|
||||
RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)) const>
|
||||
, ClassA, BOOST_PP_ENUM_PARAMS(N, A)
|
||||
>::type>
|
||||
bind(
|
||||
RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(N, T)) const
|
||||
, ClassA const& obj
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
typedef detail::member_function_ptr<
|
||||
N, RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)) const> fp_type;
|
||||
return compose<detail::function_eval<BOOST_PP_INC(N)> >(
|
||||
fp_type(f), obj, BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
template <typename RT
|
||||
, typename ClassT
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename T)
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<BOOST_PP_INC(N)>
|
||||
, detail::member_function_ptr<N,
|
||||
RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T))>
|
||||
, actor<reference<ClassT> >
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)
|
||||
>::type>
|
||||
bind(
|
||||
RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(N, T))
|
||||
, ClassT& obj
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
typedef detail::member_function_ptr<
|
||||
N, RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T))> fp_type;
|
||||
return compose<detail::function_eval<BOOST_PP_INC(N)> >(
|
||||
fp_type(f)
|
||||
, actor<reference<ClassT> >(reference<ClassT>(obj))
|
||||
, BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
template <typename RT
|
||||
, typename ClassT
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename T)
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<
|
||||
typename as_composite<
|
||||
detail::function_eval<BOOST_PP_INC(N)>
|
||||
, detail::member_function_ptr<N,
|
||||
RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)) const>
|
||||
, actor<reference<ClassT> >
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)
|
||||
>::type>
|
||||
bind(
|
||||
RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(N, T)) const
|
||||
, ClassT& obj
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
typedef detail::member_function_ptr<
|
||||
N, RT, RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)) const> fp_type;
|
||||
return compose<detail::function_eval<BOOST_PP_INC(N)> >(
|
||||
fp_type(f)
|
||||
, actor<reference<ClassT> >(reference<ClassT>(obj))
|
||||
, BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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(BOOST_PP_IS_ITERATING)
|
||||
#if !defined(PHOENIX_BIND_DETAIL_FUNCTION_PTR_HPP)
|
||||
#define PHOENIX_BIND_DETAIL_FUNCTION_PTR_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct function_ptr_impl
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl;
|
||||
};
|
||||
|
||||
template <int N, typename RT, typename FP>
|
||||
struct function_ptr : function_ptr_impl<N>::template impl<RT, FP>
|
||||
{
|
||||
typedef typename function_ptr_impl<N>::template impl<RT, FP> base;
|
||||
function_ptr(FP fp)
|
||||
: base(fp) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct function_ptr_impl<0>
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl
|
||||
{
|
||||
typedef RT result_type;
|
||||
|
||||
impl(FP fp)
|
||||
: fp(fp) {}
|
||||
|
||||
RT operator()() const
|
||||
{
|
||||
return fp();
|
||||
}
|
||||
|
||||
FP fp;
|
||||
};
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/bind/detail/function_ptr.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}} // namespace boost::phoenix::detail
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct function_ptr_impl<N>
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl
|
||||
{
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
struct result
|
||||
{
|
||||
typedef RT type;
|
||||
};
|
||||
|
||||
impl(FP fp)
|
||||
: fp(fp) {}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
RT operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _)) const
|
||||
{
|
||||
return fp(BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
FP fp;
|
||||
};
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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(BOOST_PP_IS_ITERATING)
|
||||
#if !defined(PHOENIX_BIND_DETAIL_MEMBER_FUNCTION_PTR_HPP)
|
||||
#define PHOENIX_BIND_DETAIL_MEMBER_FUNCTION_PTR_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct member_function_ptr_impl
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl;
|
||||
};
|
||||
|
||||
template <int N, typename RT, typename FP>
|
||||
struct member_function_ptr
|
||||
: member_function_ptr_impl<N>::template impl<RT, FP>
|
||||
{
|
||||
typedef typename member_function_ptr_impl<N>::
|
||||
template impl<RT, FP> base;
|
||||
member_function_ptr(FP fp)
|
||||
: base(fp) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct member_function_ptr_impl<0>
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl
|
||||
{
|
||||
template <typename Class>
|
||||
struct result
|
||||
{
|
||||
typedef RT type;
|
||||
};
|
||||
|
||||
impl(FP fp)
|
||||
: fp(fp) {}
|
||||
|
||||
template <typename Class>
|
||||
RT operator()(Class& obj) const
|
||||
{
|
||||
return (obj.*fp)();
|
||||
}
|
||||
|
||||
template <typename Class>
|
||||
RT operator()(Class* obj) const
|
||||
{
|
||||
return (obj->*fp)();
|
||||
}
|
||||
|
||||
FP fp;
|
||||
};
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/bind/detail/member_function_ptr.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}} // namespace boost::phoenix::detail
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct member_function_ptr_impl<N>
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl
|
||||
{
|
||||
template <typename Class, BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
struct result
|
||||
{
|
||||
typedef RT type;
|
||||
};
|
||||
|
||||
impl(FP fp)
|
||||
: fp(fp) {}
|
||||
|
||||
template <typename Class, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
RT operator()(Class& obj, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _)) const
|
||||
{
|
||||
return (obj.*fp)(BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
template <typename Class, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
RT operator()(Class* obj, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _)) const
|
||||
{
|
||||
return (obj->*fp)(BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
FP fp;
|
||||
};
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CONTAINER_HPP
|
||||
#define PHOENIX_CONTAINER_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/stl/container/container.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,23 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_HPP
|
||||
#define PHOENIX_CORE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/basic_environment.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/as_actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/is_actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/argument.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/value.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/nothing.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,194 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_ACTOR_HPP
|
||||
#define PHOENIX_CORE_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
|
||||
#if !defined(BOOST_RESULT_OF_NUM_ARGS)
|
||||
# define BOOST_RESULT_OF_NUM_ARGS PHOENIX_ACTOR_LIMIT
|
||||
#elif (BOOST_RESULT_OF_NUM_ARGS < PHOENIX_ACTOR_LIMIT)
|
||||
# error "BOOST_RESULT_OF_NUM_ARGS < PHOENIX_ACTOR_LIMIT"
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/basic_environment.hpp>
|
||||
#include <boost/mpl/min.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
// phoenix::void_ is the same as fusion::void_
|
||||
typedef fusion::void_ void_;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Forward declarations. These will come in when we get to the
|
||||
// operator module, yet, the actor's assignment operator and index
|
||||
// operator are required to be members.
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct make_assign_composite;
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct make_index_composite;
|
||||
|
||||
template <typename BaseT0, typename BaseT1>
|
||||
struct comma_result;
|
||||
|
||||
// error no arguments supplied
|
||||
struct error_expecting_arguments
|
||||
{
|
||||
template <typename T>
|
||||
error_expecting_arguments(T const&) {}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Eval, typename Env>
|
||||
struct eval_result
|
||||
{
|
||||
typedef typename Eval::template result<Env>::type type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4522) // multiple assignment operators specified warning
|
||||
#endif
|
||||
|
||||
template <typename Eval>
|
||||
struct actor : Eval
|
||||
{
|
||||
typedef actor<Eval> self_type;
|
||||
typedef Eval eval_type;
|
||||
|
||||
template <class Sig> struct result {};
|
||||
|
||||
actor()
|
||||
: Eval() {}
|
||||
|
||||
actor(Eval const& base)
|
||||
: Eval(base) {}
|
||||
|
||||
template <typename T0>
|
||||
explicit actor(T0 const& _0)
|
||||
: Eval(_0) {}
|
||||
|
||||
template <typename T0, typename T1>
|
||||
actor(T0 const& _0, T1 const& _1)
|
||||
: Eval(_0, _1) {}
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
typename Eval::no_nullary // avoid calling eval_result when this is true
|
||||
, mpl::identity<detail::error_expecting_arguments>
|
||||
, eval_result<eval_type, basic_environment<> >
|
||||
>::type
|
||||
nullary_result;
|
||||
|
||||
actor& operator=(actor const& rhs)
|
||||
{
|
||||
Eval::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
actor& operator=(actor& rhs)
|
||||
{
|
||||
Eval::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nullary_result
|
||||
operator()() const
|
||||
{
|
||||
return eval_type::eval(basic_environment<>());
|
||||
}
|
||||
|
||||
template <class F, class A0>
|
||||
struct result<F(A0)>
|
||||
: eval_result<
|
||||
eval_type
|
||||
, basic_environment<
|
||||
typename remove_reference<A0>::type
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename T0>
|
||||
typename result<actor(T0&)>::type
|
||||
operator()(T0& _0) const
|
||||
{
|
||||
return eval_type::eval(basic_environment<T0>(_0));
|
||||
}
|
||||
|
||||
template <class F, class A0, class A1>
|
||||
struct result<F(A0,A1)>
|
||||
: eval_result<
|
||||
eval_type
|
||||
, basic_environment<
|
||||
typename remove_reference<A0>::type
|
||||
, typename remove_reference<A1>::type
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
typename result<actor(T0&,T1&)>::type
|
||||
operator()(T0& _0, T1& _1) const
|
||||
{
|
||||
return eval_type::eval(basic_environment<T0, T1>(_0, _1));
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
typename detail::make_assign_composite<self_type, T1>::type
|
||||
operator=(T1 const& a1) const;
|
||||
|
||||
template <typename T1>
|
||||
typename detail::make_index_composite<self_type, T1>::type
|
||||
operator[](T1 const& a1) const;
|
||||
|
||||
// Bring in the rest of the constructors and function call operators
|
||||
#include <boost/spirit/home/phoenix/core/detail/actor.hpp>
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// Forward declaration: The intent to overload the comma must be
|
||||
// stated early on to avoid the subtle problem that arises when
|
||||
// the header file where the comma operator overload is defined,
|
||||
// is not included by the client and the client attempts to use
|
||||
// the comma anyway.
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename BaseT0, typename BaseT1>
|
||||
struct comma_result;
|
||||
}
|
||||
|
||||
template <typename BaseT0, typename BaseT1>
|
||||
typename detail::comma_result<BaseT0, BaseT1>::type
|
||||
operator,(actor<BaseT0> const& a0, actor<BaseT1> const& a1);
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <typename Eval>
|
||||
struct result_of<phoenix::actor<Eval>()>
|
||||
{
|
||||
typedef typename phoenix::actor<Eval>::nullary_result type;
|
||||
};
|
||||
|
||||
template <typename Eval>
|
||||
struct result_of<phoenix::actor<Eval> const()>
|
||||
: result_of<phoenix::actor<Eval>()>
|
||||
{};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,99 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_ARGUMENT_HPP
|
||||
#define PHOENIX_CORE_ARGUMENT_HPP
|
||||
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#define PHOENIX_DECLARE_ARG(z, n, data) \
|
||||
typedef actor<argument<n> > \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); \
|
||||
actor<argument<n> > const \
|
||||
BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument<n>(); \
|
||||
typedef actor<argument<n> > \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
|
||||
actor<argument<n> > const \
|
||||
BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename Arg>
|
||||
struct error_argument_not_found {};
|
||||
inline void test_invalid_argument(int) {}
|
||||
}
|
||||
|
||||
template <int N>
|
||||
struct argument
|
||||
{
|
||||
typedef mpl::true_ no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
fusion::result_of::at<typename Env::tie_type, mpl::int_<N> >::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
mpl::less<mpl::int_<N>, mpl::size<typename Env::args_type> >
|
||||
, int
|
||||
, detail::error_argument_not_found<argument<N> >
|
||||
>::type
|
||||
check_out_of_bounds;
|
||||
|
||||
detail::test_invalid_argument(check_out_of_bounds());
|
||||
return fusion::at_c<N>(env.args());
|
||||
}
|
||||
};
|
||||
|
||||
namespace arg_names
|
||||
{
|
||||
// Phoenix style names
|
||||
typedef actor<argument<0> > arg1_type;
|
||||
actor<argument<0> > const arg1 = argument<0>();
|
||||
typedef actor<argument<1> > arg2_type;
|
||||
actor<argument<1> > const arg2 = argument<1>();
|
||||
typedef actor<argument<2> > arg3_type;
|
||||
actor<argument<2> > const arg3 = argument<2>();
|
||||
|
||||
// BLL style names
|
||||
typedef actor<argument<0> > _1_type;
|
||||
actor<argument<0> > const _1 = argument<0>();
|
||||
typedef actor<argument<1> > _2_type;
|
||||
actor<argument<1> > const _2 = argument<1>();
|
||||
typedef actor<argument<2> > _3_type;
|
||||
actor<argument<2> > const _3 = argument<2>();
|
||||
|
||||
// Bring in the rest or the Phoenix style arguments (arg4 .. argN+1)
|
||||
// and BLL style arguments (_4 .. _N+1), using PP
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
3, PHOENIX_ARG_LIMIT, PHOENIX_DECLARE_ARG, _)
|
||||
}
|
||||
}}
|
||||
|
||||
#undef PHOENIX_DECLARE_ARG
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_AS_ACTOR_HPP
|
||||
#define PHOENIX_CORE_AS_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename T>
|
||||
struct as_actor_base; // defined in value.hpp
|
||||
|
||||
template <typename Base>
|
||||
struct as_actor_base<actor<Base> >
|
||||
{
|
||||
typedef Base type;
|
||||
|
||||
static Base const&
|
||||
convert(actor<Base> const& x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct as_actor_base<fusion::void_>
|
||||
{
|
||||
typedef fusion::void_ type;
|
||||
struct error_attempting_to_convert_void_type_to_an_actor {};
|
||||
|
||||
static void
|
||||
convert(error_attempting_to_convert_void_type_to_an_actor);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct as_actor_base<void>
|
||||
{
|
||||
typedef void type;
|
||||
struct error_attempting_to_convert_void_type_to_an_actor {};
|
||||
|
||||
static void
|
||||
convert(error_attempting_to_convert_void_type_to_an_actor);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct as_actor
|
||||
{
|
||||
typedef actor<typename as_actor_base<T>::type> type;
|
||||
|
||||
static type
|
||||
convert(T const& x)
|
||||
{
|
||||
return as_actor_base<T>::convert(x);
|
||||
}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_BASIC_ENVIRONMENT_HPP
|
||||
#define PHOENIX_CORE_BASIC_ENVIRONMENT_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/mpl/remove.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
#include <boost/fusion/include/mpl.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
PHOENIX_ARG_LIMIT, typename T, fusion::void_)>
|
||||
class basic_environment
|
||||
{
|
||||
typedef
|
||||
mpl::BOOST_PP_CAT(vector, PHOENIX_ARG_LIMIT)<
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ARG_LIMIT, T)>
|
||||
args_with_void_type;
|
||||
|
||||
public:
|
||||
|
||||
// args_type: the list of types in an mpl::sequence
|
||||
typedef typename
|
||||
mpl::remove<args_with_void_type, fusion::void_>::type
|
||||
args_type;
|
||||
|
||||
// tie_type: a fusion::tuple of references
|
||||
typedef typename
|
||||
fusion::result_of::as_vector<
|
||||
typename mpl::transform<
|
||||
args_type, boost::add_reference<mpl::_1>
|
||||
>::type
|
||||
>::type
|
||||
tie_type;
|
||||
|
||||
basic_environment()
|
||||
: args_() {}
|
||||
|
||||
template <typename U0>
|
||||
explicit basic_environment(U0& _0)
|
||||
: args_(_0) {}
|
||||
|
||||
template <typename U0, typename U1>
|
||||
basic_environment(U0& _0, U1& _1)
|
||||
: args_(_0, _1) {}
|
||||
|
||||
// Bring in the rest of the constructors
|
||||
#include <boost/spirit/home/phoenix/core/detail/basic_environment.hpp>
|
||||
|
||||
tie_type const&
|
||||
args() const
|
||||
{
|
||||
return args_;
|
||||
}
|
||||
|
||||
tie_type&
|
||||
args()
|
||||
{
|
||||
return args_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
tie_type args_;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_COMPOSE_HPP
|
||||
#define PHOENIX_CORE_COMPOSE_HPP
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/value.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/as_actor.hpp>
|
||||
|
||||
#define PHOENIX_AS_ACTOR(z, n, data) \
|
||||
typename mpl::eval_if< \
|
||||
is_same<BOOST_PP_CAT(T, n), fusion::void_> \
|
||||
, mpl::identity<fusion::void_> \
|
||||
, as_actor_base<BOOST_PP_CAT(T, n)> \
|
||||
>::type
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// as_composite<EvalPolicy, T0,... TN> metafunction
|
||||
//
|
||||
// Create a composite given an EvalPolicy and types T0..TN.
|
||||
// The types are converted to an actor through the as_actor
|
||||
// metafunction (see as_actor.hpp).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename EvalPolicy
|
||||
, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
PHOENIX_COMPOSITE_LIMIT, typename T, fusion::void_)>
|
||||
struct as_composite
|
||||
{
|
||||
typedef composite<
|
||||
EvalPolicy
|
||||
, fusion::vector<
|
||||
BOOST_PP_ENUM(PHOENIX_COMPOSITE_LIMIT, PHOENIX_AS_ACTOR, _)>
|
||||
>
|
||||
type;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// compose functions
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// compose<EvalPolicy>(_0, _1,... _N)
|
||||
//
|
||||
// Returns a composite given an EvalPolicy and arguments _0.._N.
|
||||
// The arguments are converted to an actor through the as_actor
|
||||
// metafunction (see as_actor.hpp).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename EvalPolicy>
|
||||
inline actor<typename as_composite<EvalPolicy>::type>
|
||||
compose()
|
||||
{
|
||||
return actor<typename as_composite<EvalPolicy>::type>();
|
||||
}
|
||||
|
||||
template <typename EvalPolicy, typename T0>
|
||||
inline actor<typename as_composite<EvalPolicy, T0>::type>
|
||||
compose(T0 const& _0)
|
||||
{
|
||||
return actor<typename as_composite<EvalPolicy, T0>::type>(
|
||||
as_actor<T0>::convert(_0)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename EvalPolicy, typename T0, typename T1>
|
||||
inline actor<typename as_composite<EvalPolicy, T0, T1>::type>
|
||||
compose(T0 const& _0, T1 const& _1)
|
||||
{
|
||||
return actor<typename as_composite<EvalPolicy, T0, T1>::type>(
|
||||
as_actor<T0>::convert(_0)
|
||||
, as_actor<T1>::convert(_1)
|
||||
);
|
||||
}
|
||||
|
||||
// Bring in the the rest of the compose overloads
|
||||
#include <boost/spirit/home/phoenix/core/detail/compose.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// re_curry<EvalPolicy, T0,...TN>
|
||||
//
|
||||
// returns the result of re currying T0..TN using EvalPolicy.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename EvalPolicy
|
||||
, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
PHOENIX_COMPOSITE_LIMIT, typename T, fusion::void_)>
|
||||
struct re_curry
|
||||
{
|
||||
typedef actor<
|
||||
typename as_composite<
|
||||
EvalPolicy
|
||||
, BOOST_PP_ENUM_PARAMS(PHOENIX_COMPOSITE_LIMIT, T)>::type
|
||||
>
|
||||
type;
|
||||
};
|
||||
}}
|
||||
|
||||
#undef PHOENIX_AS_ACTOR
|
||||
#endif
|
||||
@@ -1,96 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_COMPOSITE_HPP
|
||||
#define PHOENIX_CORE_COMPOSITE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/is_actor.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/fusion/include/size.hpp>
|
||||
#include <boost/fusion/include/mpl.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct composite_eval;
|
||||
|
||||
struct compute_no_nullary
|
||||
{
|
||||
template <typename State, typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
mpl::or_<typename T::no_nullary, State>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template <typename EvalPolicy, typename EvalTuple>
|
||||
struct composite : EvalTuple
|
||||
{
|
||||
typedef EvalTuple base_type;
|
||||
typedef composite<EvalPolicy, EvalTuple> self_type;
|
||||
typedef EvalPolicy eval_policy_type;
|
||||
|
||||
typedef typename
|
||||
mpl::fold<
|
||||
EvalTuple
|
||||
, mpl::false_
|
||||
, detail::compute_no_nullary
|
||||
>::type
|
||||
no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef
|
||||
typename detail::composite_eval<
|
||||
fusion::result_of::size<base_type>::value>::
|
||||
template result<self_type, Env>::type
|
||||
type;
|
||||
};
|
||||
|
||||
composite()
|
||||
: base_type() {}
|
||||
|
||||
composite(base_type const& base)
|
||||
: base_type(base) {}
|
||||
|
||||
template <typename U0>
|
||||
composite(U0& _0)
|
||||
: base_type(_0) {}
|
||||
|
||||
template <typename U0, typename U1>
|
||||
composite(U0& _0, U1& _1)
|
||||
: base_type(_0, _1) {}
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
typedef typename result<Env>::type return_type;
|
||||
return detail::
|
||||
composite_eval<fusion::result_of::size<base_type>::value>::template
|
||||
call<return_type>(*this, env);
|
||||
}
|
||||
|
||||
// Bring in the rest of the constructors
|
||||
#include <boost/spirit/home/phoenix/core/detail/composite.hpp>
|
||||
};
|
||||
|
||||
// Bring in the detail::composite_eval<0..N> definitions
|
||||
#include <boost/spirit/home/phoenix/core/detail/composite_eval.hpp>
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_CORE_DETAIL_ACTOR_HPP
|
||||
#define PHOENIX_CORE_DETAIL_ACTOR_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_ACTOR_LIMIT, \
|
||||
"boost/spirit/home/phoenix/core/detail/actor.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
actor(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
|
||||
: Eval(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
template <typename F, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
struct result<F(BOOST_PP_ENUM_PARAMS(N, A))>
|
||||
: eval_result<
|
||||
eval_type
|
||||
, basic_environment<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
N
|
||||
, typename remove_reference<A
|
||||
, >::type BOOST_PP_INTERCEPT
|
||||
)
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
typename result<
|
||||
actor(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & BOOST_PP_INTERCEPT))
|
||||
>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) const
|
||||
{
|
||||
return eval_type::eval(
|
||||
basic_environment<BOOST_PP_ENUM_PARAMS(N, T)>(
|
||||
BOOST_PP_ENUM_PARAMS(N, _))
|
||||
);
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_CORE_DETAIL_BASIC_ENVIRONMENT_HPP
|
||||
#define PHOENIX_CORE_DETAIL_BASIC_ENVIRONMENT_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_ARG_LIMIT, \
|
||||
"boost/spirit/home/phoenix/core/detail/basic_environment.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
|
||||
basic_environment(BOOST_PP_ENUM_BINARY_PARAMS(N, U, & _))
|
||||
: args_(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_CORE_DETAIL_COMPOSE_DETAIL_HPP
|
||||
#define PHOENIX_CORE_DETAIL_COMPOSE_DETAIL_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
|
||||
#define PHOENIX_AS_ACTOR_CONVERT(z, n, data) \
|
||||
as_actor<BOOST_PP_CAT(T, n)>::convert(BOOST_PP_CAT(_, n))
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/core/detail/compose.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef PHOENIX_AS_ACTOR_CONVERT
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename EvalPolicy, BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
inline actor<
|
||||
typename as_composite<EvalPolicy, BOOST_PP_ENUM_PARAMS(N, T)>::type>
|
||||
compose(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
|
||||
{
|
||||
return actor<
|
||||
typename as_composite<EvalPolicy, BOOST_PP_ENUM_PARAMS(N, T)>::type>(
|
||||
BOOST_PP_ENUM(N, PHOENIX_AS_ACTOR_CONVERT, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_CORE_DETAIL_COMPOSITE_HPP
|
||||
#define PHOENIX_CORE_DETAIL_COMPOSITE_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/core/detail/composite.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
|
||||
composite(BOOST_PP_ENUM_BINARY_PARAMS(N, U, & _))
|
||||
: base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_CORE_DETAIL_COMPOSITE_EVAL_HPP
|
||||
#define PHOENIX_CORE_DETAIL_COMPOSITE_EVAL_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct composite_eval;
|
||||
|
||||
template <>
|
||||
struct composite_eval<0>
|
||||
{
|
||||
template <typename Composite, typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename Composite::eval_policy_type::
|
||||
template result<Env>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Composite, typename Env>
|
||||
static RT
|
||||
call(Composite const& /*composite*/, Env const& env)
|
||||
{
|
||||
typedef typename Composite::eval_policy_type eval_policy_type;
|
||||
return eval_policy_type::template eval<RT>(env);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Actor, typename Env>
|
||||
struct eval_is_actor
|
||||
: is_actor<typename Actor::template result<Env>::type> {};
|
||||
|
||||
template <typename Actor, typename Env>
|
||||
struct eval_is_void
|
||||
: is_same<typename Actor::template result<Env>::type, fusion::void_> {};
|
||||
}
|
||||
|
||||
#define PHOENIX_GET_ACTOR_TYPE(z, n, data) \
|
||||
typedef \
|
||||
typename fusion::result_of::value_at_c<Composite, n>::type \
|
||||
BOOST_PP_CAT(actor, n);
|
||||
|
||||
#define PHOENIX_GET_ACTOR(z, n, data) \
|
||||
fusion::at_c<n>(composite)
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/core/detail/composite_eval.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef PHOENIX_GET_ACTOR
|
||||
#undef PHOENIX_GET_ACTOR_TYPE
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <>
|
||||
struct composite_eval<N>
|
||||
{
|
||||
template <typename Composite, typename Env>
|
||||
struct result
|
||||
{
|
||||
BOOST_PP_REPEAT(N, PHOENIX_GET_ACTOR_TYPE, _)
|
||||
|
||||
typedef typename
|
||||
Composite::eval_policy_type::template result<
|
||||
Env, BOOST_PP_ENUM_PARAMS(N, actor)
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Composite, typename Env>
|
||||
static RT
|
||||
call(Composite const& composite, Env const& env)
|
||||
{
|
||||
typedef typename Composite::eval_policy_type eval_policy_type;
|
||||
return eval_policy_type::template eval<RT>(
|
||||
env, BOOST_PP_ENUM(N, PHOENIX_GET_ACTOR, _));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_DETAIL_COMPOSITE_INFO_HPP
|
||||
#define PHOENIX_CORE_DETAIL_COMPOSITE_INFO_HPP
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/greater.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/spirit/home/fusion/algorithm/fold.hpp>
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
struct max_nesting
|
||||
{
|
||||
template <typename T, typename State>
|
||||
struct result :
|
||||
mpl::if_<
|
||||
mpl::greater<typename T::nesting, State>
|
||||
, typename T::nesting
|
||||
, State
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template <typename ActorTuple>
|
||||
struct compute_nesting
|
||||
{
|
||||
typedef typename
|
||||
fusion::meta::fold<ActorTuple, mpl::int_<0>, max_nesting>::type
|
||||
type;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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(BOOST_PP_IS_ITERATING)
|
||||
#if !defined(PHOENIX_CORE_DETAIL_FUNCTION_EVAL_HPP)
|
||||
#define PHOENIX_CORE_DETAIL_FUNCTION_EVAL_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/enum.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
// we assume that mpl::vectorN, where N = PHOENIX_COMPOSITE_LIMIT
|
||||
// is included already.
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct function_eval;
|
||||
|
||||
template <>
|
||||
struct function_eval<0>
|
||||
{
|
||||
template <typename Env, typename F>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
remove_reference<
|
||||
typename F::template result<Env>::type
|
||||
>::type
|
||||
fn;
|
||||
typedef typename fn::result_type type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename F>
|
||||
static RT
|
||||
eval(Env const& env, F const& f)
|
||||
{
|
||||
return f.eval(env)();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T& help_rvalue_deduction(T& x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T const& help_rvalue_deduction(T const& x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
// When we call f(_0, _1...) we remove the reference when deducing f's
|
||||
// return type. $$$ Explain why $$$
|
||||
|
||||
#define PHOENIX_GET_ARG(z, n, data) \
|
||||
typedef typename \
|
||||
remove_reference< \
|
||||
typename BOOST_PP_CAT(A, n)::template result<Env>::type \
|
||||
>::type \
|
||||
BOOST_PP_CAT(a, n);
|
||||
|
||||
#define PHOENIX_EVAL_ARG(z, n, data) \
|
||||
help_rvalue_deduction(BOOST_PP_CAT(_, n).eval(env))
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT), \
|
||||
"boost/spirit/home/phoenix/core/detail/function_eval.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}} // namespace boost::phoenix::detail
|
||||
|
||||
#undef PHOENIX_GET_ARG
|
||||
#undef PHOENIX_EVAL_ARG
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct function_eval<N>
|
||||
{
|
||||
template <typename Env, typename F
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
remove_reference<
|
||||
typename F::template result<Env>::type
|
||||
>::type
|
||||
fn;
|
||||
BOOST_PP_REPEAT(N, PHOENIX_GET_ARG, _)
|
||||
|
||||
typedef BOOST_PP_CAT(mpl::vector, N)
|
||||
<BOOST_PP_ENUM_PARAMS(N, a)>
|
||||
args;
|
||||
|
||||
typedef typename
|
||||
fn::template result<BOOST_PP_ENUM_PARAMS(N, a)>
|
||||
function_apply;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_same<
|
||||
typename mpl::find<args, fusion::void_>::type
|
||||
, typename mpl::end<args>::type>
|
||||
, function_apply
|
||||
, mpl::identity<fusion::void_>
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename F
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
static RT
|
||||
eval(Env const& env, F const& f
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _))
|
||||
{
|
||||
return f.eval(env)(BOOST_PP_ENUM(N, PHOENIX_EVAL_ARG, _));
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_IS_ACTOR_HPP
|
||||
#define PHOENIX_CORE_IS_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// is_actor<T>
|
||||
//
|
||||
// Tests if T is an actor. Evaluates to mpl::true_ or mpl::false_
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
struct is_actor : mpl::false_ {};
|
||||
|
||||
template <typename Base>
|
||||
struct is_actor<actor<Base> > : mpl::true_ {};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_LIMITS_HPP
|
||||
#define PHOENIX_CORE_LIMITS_HPP
|
||||
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
|
||||
#if !defined(PHOENIX_LIMIT)
|
||||
# define PHOENIX_LIMIT 10
|
||||
#elif (PHOENIX_LIMIT < 5)
|
||||
# error "PHOENIX_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_ARG_LIMIT)
|
||||
# define PHOENIX_ARG_LIMIT PHOENIX_LIMIT
|
||||
#elif (PHOENIX_ARG_LIMIT < 5)
|
||||
# error "PHOENIX_ARG_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_ACTOR_LIMIT)
|
||||
# define PHOENIX_ACTOR_LIMIT PHOENIX_LIMIT
|
||||
#elif (PHOENIX_ACTOR_LIMIT > PHOENIX_ARG_LIMIT)
|
||||
# error "PHOENIX_ACTOR_LIMIT > PHOENIX_ARG_LIMIT"
|
||||
#elif (PHOENIX_ACTOR_LIMIT < 3)
|
||||
# error "PHOENIX_ACTOR_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_COMPOSITE_LIMIT)
|
||||
# define PHOENIX_COMPOSITE_LIMIT PHOENIX_LIMIT
|
||||
#elif (PHOENIX_COMPOSITE_LIMIT < 5)
|
||||
# error "PHOENIX_COMPOSITE_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_MEMBER_LIMIT)
|
||||
# define PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT))
|
||||
#elif (PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT)
|
||||
# error "PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT"
|
||||
#elif (PHOENIX_MEMBER_LIMIT < 3)
|
||||
# error "PHOENIX_MEMBER_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_CATCH_LIMIT)
|
||||
# define PHOENIX_CATCH_LIMIT BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT)
|
||||
#elif (PHOENIX_CATCH_LIMIT < 1)
|
||||
# error "PHOENIX_CATCH_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_DYNAMIC_LIMIT)
|
||||
# define PHOENIX_DYNAMIC_LIMIT PHOENIX_LIMIT
|
||||
#elif (PHOENIX_DYNAMIC_LIMIT < 1)
|
||||
# error "PHOENIX_DYNAMIC_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_LOCAL_LIMIT)
|
||||
# define PHOENIX_LOCAL_LIMIT PHOENIX_LIMIT
|
||||
#elif (PHOENIX_LOCAL_LIMIT < 3)
|
||||
# error "PHOENIX_LOCAL_LIMIT is set too low"
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(FUSION_MAX_VECTOR_SIZE)
|
||||
# define FUSION_MAX_VECTOR_SIZE PHOENIX_LIMIT
|
||||
#elif (FUSION_MAX_VECTOR_SIZE < PHOENIX_LIMIT)
|
||||
# error "FUSION_MAX_VECTOR_SIZE < PHOENIX_LIMIT"
|
||||
#endif
|
||||
|
||||
// this include will bring in mpl::vectorN and
|
||||
// fusion::vectorN where N is PHOENIX_LIMIT
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
// for some reason, this must be included now to make
|
||||
// detail/type_deduction.hpp compile. $$$ TODO: Investigate further $$$
|
||||
#include <boost/mpl/vector/vector20.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_NOTHING_HPP
|
||||
#define PHOENIX_CORE_NOTHING_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// null_actor
|
||||
//
|
||||
// A actor that does nothing (a "bum", if you will :-).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
struct null_actor
|
||||
{
|
||||
typedef mpl::false_ no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename Env>
|
||||
void
|
||||
eval(Env const&) const
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
actor<null_actor> const nothing = null_actor();
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_REFERENCE_HPP
|
||||
#define PHOENIX_CORE_REFERENCE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename T>
|
||||
struct reference
|
||||
{
|
||||
// $$$ TODO: a better (user friendly) static assert
|
||||
BOOST_STATIC_ASSERT(
|
||||
mpl::not_<is_reference<T> >::value != 0);
|
||||
|
||||
typedef mpl::false_ no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
reference(T& arg)
|
||||
: ref(arg) {}
|
||||
|
||||
template <typename Env>
|
||||
T& eval(Env const&) const
|
||||
{
|
||||
return ref;
|
||||
}
|
||||
|
||||
T& ref;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
reference& operator= (reference const&);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline actor<reference<T> > const
|
||||
ref(T& v)
|
||||
{
|
||||
return reference<T>(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline actor<reference<T const> > const
|
||||
cref(T const& v)
|
||||
{
|
||||
return reference<T const>(v);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct error_attempting_to_convert_an_actor_to_a_reference {};
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
void
|
||||
ref(actor<Base> const& v
|
||||
, detail::error_attempting_to_convert_an_actor_to_a_reference
|
||||
= detail::error_attempting_to_convert_an_actor_to_a_reference());
|
||||
|
||||
template <typename Base>
|
||||
void
|
||||
cref(actor<Base> const& v
|
||||
, detail::error_attempting_to_convert_an_actor_to_a_reference
|
||||
= detail::error_attempting_to_convert_an_actor_to_a_reference());
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,158 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_CORE_VALUE_HPP
|
||||
#define PHOENIX_CORE_VALUE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/as_actor.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace meta
|
||||
{
|
||||
template<typename T>
|
||||
struct const_ref
|
||||
: add_reference<typename add_const<T>::type>
|
||||
{};
|
||||
|
||||
template<typename T>
|
||||
struct argument_type
|
||||
: mpl::eval_if<
|
||||
is_function<typename remove_pointer<T>::type>,
|
||||
mpl::identity<T>,
|
||||
const_ref<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct value
|
||||
{
|
||||
BOOST_STATIC_ASSERT(
|
||||
mpl::not_<is_reference<T> >::value != 0);
|
||||
|
||||
typedef mpl::false_ no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
value()
|
||||
: val() {}
|
||||
|
||||
value(T const& arg)
|
||||
: val(arg) {}
|
||||
|
||||
template <typename Env>
|
||||
T const&
|
||||
eval(Env const&) const
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
T val;
|
||||
};
|
||||
|
||||
template <typename Actor>
|
||||
struct actor_value
|
||||
{
|
||||
typedef typename Actor::no_nullary no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
remove_reference<
|
||||
typename eval_result<Actor, Env>::type
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
actor_value(Actor const& actor_)
|
||||
: actor(actor_) {}
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
return actor.eval(env);
|
||||
}
|
||||
|
||||
Actor actor;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline typename as_actor<T>::type
|
||||
val(T const& v)
|
||||
{
|
||||
return as_actor<T>::convert(v);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
inline actor<actor_value<Derived> >
|
||||
val(actor<Derived> const& actor)
|
||||
{
|
||||
return actor_value<Derived>(actor);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct as_actor_base
|
||||
{
|
||||
typedef value<T> type;
|
||||
|
||||
static value<T>
|
||||
convert(typename meta::argument_type<T>::type x)
|
||||
{
|
||||
return value<T>(x);
|
||||
}
|
||||
};
|
||||
|
||||
// Sometimes it is necessary to auto-convert references to
|
||||
// a value<T>. This happens when we are re-currying. This
|
||||
// cannot happen through the standard public actor interfaces.
|
||||
template <typename T>
|
||||
struct as_actor_base<T&>
|
||||
{
|
||||
typedef value<T> type;
|
||||
|
||||
static value<T>
|
||||
convert(T& x)
|
||||
{
|
||||
return value<T>(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, int N>
|
||||
struct as_actor_base<T[N]>
|
||||
{
|
||||
typedef value<T const*> type;
|
||||
|
||||
static value<T const*>
|
||||
convert(T const x[N])
|
||||
{
|
||||
return value<T const*>(x);
|
||||
}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_DETAIL_LOCAL_REFERENCE_HPP
|
||||
#define PHOENIX_DETAIL_LOCAL_REFERENCE_HPP
|
||||
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct local_reference
|
||||
{
|
||||
typedef T type;
|
||||
|
||||
explicit local_reference(T& t): t_(boost::addressof(t)) {}
|
||||
operator T& () const { return *t_; }
|
||||
local_reference& operator=(T const& x) { *t_ = x; return *this; }
|
||||
local_reference const& operator=(T const& x) const { *t_ = x; return *this; }
|
||||
T& get() const { return *t_; }
|
||||
T* get_pointer() const { return t_; }
|
||||
|
||||
private:
|
||||
|
||||
T* t_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct unwrap_local_reference
|
||||
{
|
||||
typedef T type; // T should be a reference
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct unwrap_local_reference<local_reference<T> >
|
||||
{
|
||||
typedef T type; // unwrap the reference; T is a value
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -1,491 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_DETAIL_TYPE_DEDUCTION_HPP
|
||||
#define PHOENIX_DETAIL_TYPE_DEDUCTION_HPP
|
||||
|
||||
/*=============================================================================
|
||||
|
||||
Return Type Deduction
|
||||
[JDG Sept. 15, 2003]
|
||||
|
||||
Before C++ adopts the typeof, there is currently no way to deduce the
|
||||
result type of an expression such as x + y. This deficiency is a major
|
||||
problem with template metaprogramming; for example, when writing
|
||||
forwarding functions that attempt to capture the essence of an
|
||||
expression inside a function. Consider the std::plus<T>:
|
||||
|
||||
template <typename T>
|
||||
struct plus : public binary_function<T, T, T>
|
||||
{
|
||||
T operator()(T const& x, T const& y) const
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
};
|
||||
|
||||
What's wrong with this? Well, this functor does not accurately capture
|
||||
the behavior of the plus operator. 1) It does not handle the case where
|
||||
x and y are of different types (e.g. x is short and y is int). 2) It
|
||||
assumes that the arguments and return type are the same (i.e. when
|
||||
adding a short and an int, the return type ought to be an int). Due to
|
||||
these shortcomings, std::plus<T>(x, y) is a poor substitute for x + y.
|
||||
|
||||
The case where x is short and y is int does not really expose the
|
||||
problem. We can simply use std::plus<int> and be happy that the
|
||||
operands x and y will simply be converted to an int. The problem
|
||||
becomes evident when an operand is a user defined type such as bigint.
|
||||
Here, the conversion to bigint is simply not acceptable. Even if the
|
||||
unnecessary conversion is tolerable, in generic code, it is not always
|
||||
possible to choose the right T type that can accomodate both x and y
|
||||
operands.
|
||||
|
||||
To truly model the plus operator, what we need is a polymorphic functor
|
||||
that can take arbitrary x and y operands. Here's a rough schematic:
|
||||
|
||||
struct plus
|
||||
{
|
||||
template <typename X, typename Y>
|
||||
unspecified-type
|
||||
operator()(X const& x, Y const& y) const
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
};
|
||||
|
||||
Now, we can handle the case where X and Y are arbitrary types. We've
|
||||
solved the first problem. To solve the second problem, we need some
|
||||
form of return type deduction mechanism. If we had the typeof, it would
|
||||
be something like:
|
||||
|
||||
template <typename X, typename Y>
|
||||
typeof(X() + Y())
|
||||
operator()(X const& x, Y const& y) const
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
|
||||
Without the typeof facility, it is only possible to wrap an expression
|
||||
such as x + y in a function or functor if we are given a hint that
|
||||
tells us what the actual result type of such an expression is. Such a
|
||||
hint can be in the form of a metaprogram, that, given the types of the
|
||||
arguments, will return the result type. Example:
|
||||
|
||||
template <typename X, typename Y>
|
||||
struct result_of_plus
|
||||
{
|
||||
typedef unspecified-type type;
|
||||
};
|
||||
|
||||
Given a result_of_plus metaprogram, we can complete our polymorphic
|
||||
plus functor:
|
||||
|
||||
struct plus
|
||||
{
|
||||
template <typename X, typename Y>
|
||||
typename result_of_plus<X, Y>::type
|
||||
operator()(X const& x, Y const& y) const
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
};
|
||||
|
||||
The process is not automatic. We have to specialize the metaprogram for
|
||||
specific argument types. Examples:
|
||||
|
||||
template <>
|
||||
struct result_of_plus<short, int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct result_of_plus<std::complex<T>, std::complex<T> >
|
||||
{
|
||||
typedef std::complex<T> type;
|
||||
};
|
||||
|
||||
To make it easier for the user, specializations are provided for common
|
||||
types such as primitive c++ types (e.g. int, char, double, etc.), and
|
||||
standard types (e.g. std::complex, iostream, std containers and
|
||||
iterators).
|
||||
|
||||
To further improve the ease of use, for user defined classes, we can
|
||||
supply a few more basic specializations through metaprogramming using
|
||||
heuristics based on canonical operator rules (Such heuristics can be
|
||||
found in the LL and Phoenix, for example). For example, it is rather
|
||||
common that the result of x += y is X& or the result of x || y is a
|
||||
bool. The client is out of luck if her classes do not follow the
|
||||
canonical rules. She'll then have to supply her own specialization.
|
||||
|
||||
The type deduction mechanism demostrated below approaches the problem
|
||||
not through specialization and heuristics, but through a limited form
|
||||
of typeof mechanism. The code does not use heuristics, hence, no
|
||||
guessing games. The code takes advantage of the fact that, in general,
|
||||
the result type of an expression is related to one its arguments' type.
|
||||
For example, x + y, where x has type int and y has type double, has the
|
||||
result type double (the second operand type). Another example, x[y]
|
||||
where x is a vector<T> and y is a std::size_t, has the result type
|
||||
vector<T>::reference (the vector<T>'s reference type type).
|
||||
|
||||
The limited form of type deduction presented can detect common
|
||||
relations if the result of a binary or unary operation, given arguments
|
||||
x and y with types X and Y (respectively), is X, Y, X&, Y&, X*, Y*, X
|
||||
const*, Y const*, bool, int, unsigned, double, container and iterator
|
||||
elements (e.g the T, where X is: T[N], T*, vector<T>, map<T>,
|
||||
vector<T>::iterator). More arguments/return type relationships can be
|
||||
established if needed.
|
||||
|
||||
A set of overloaded test(T) functions capture these argument related
|
||||
types. Each test(T) function returns a distinct type that can be used
|
||||
to determine the exact type of an expression.
|
||||
|
||||
Consider:
|
||||
|
||||
template <typename X, typename Y>
|
||||
x_value_type
|
||||
test(X const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
y_value_type
|
||||
test(Y const&);
|
||||
|
||||
Given an expression x + y, where x is int and y is double, the call to:
|
||||
|
||||
test<int, double>(x + y)
|
||||
|
||||
will return a y_value_type.
|
||||
|
||||
Now, if we rig x_value_type and y_value_type such that both have unique
|
||||
sizes, we can use sizeof(test<X, Y>(x + y)) to determine if the result
|
||||
type is either X or Y.
|
||||
|
||||
For example, if:
|
||||
|
||||
sizeof(test<X, Y>(x + y)) == sizeof(y_value_type)
|
||||
|
||||
then, we know for sure that the result of x + y has type Y.
|
||||
|
||||
The same basic scheme can be used to detect more argument-dependent
|
||||
return types where the sizeof the test(T) return type is used to index
|
||||
through a boost::mpl vector which holds each of the corresponding
|
||||
result types.
|
||||
|
||||
==============================================================================*/
|
||||
#include <boost/mpl/vector/vector20.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/local_reference.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
struct error_cant_deduce_type {};
|
||||
}
|
||||
|
||||
namespace boost { namespace type_deduction_detail
|
||||
{
|
||||
typedef char(&bool_value_type)[1];
|
||||
typedef char(&int_value_type)[2];
|
||||
typedef char(&uint_value_type)[3];
|
||||
typedef char(&double_value_type)[4];
|
||||
|
||||
typedef char(&bool_reference_type)[5];
|
||||
typedef char(&int_reference_type)[6];
|
||||
typedef char(&uint_reference_type)[7];
|
||||
typedef char(&double_reference_type)[8];
|
||||
|
||||
typedef char(&x_value_type)[9];
|
||||
typedef char(&x_reference_type)[10];
|
||||
typedef char(&x_const_pointer_type)[11];
|
||||
typedef char(&x_pointer_type)[12];
|
||||
|
||||
typedef char(&y_value_type)[13];
|
||||
typedef char(&y_reference_type)[14];
|
||||
typedef char(&y_const_pointer_type)[15];
|
||||
typedef char(&y_pointer_type)[16];
|
||||
|
||||
typedef char(&container_reference_type)[17];
|
||||
typedef char(&container_const_reference_type)[18];
|
||||
typedef char(&container_mapped_type)[19];
|
||||
|
||||
typedef char(&cant_deduce_type)[20];
|
||||
|
||||
template <typename T, typename Plain = typename remove_cv<T>::type>
|
||||
struct is_basic
|
||||
: mpl::or_<
|
||||
is_same<Plain, bool>
|
||||
, is_same<Plain, int>
|
||||
, is_same<Plain, unsigned>
|
||||
, is_same<Plain, double>
|
||||
> {};
|
||||
|
||||
template <typename C>
|
||||
struct reference_type
|
||||
{
|
||||
typedef typename C::reference type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct reference_type<T const>
|
||||
: reference_type<T> {};
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct reference_type<T[N]>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct reference_type<T*>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
template <typename C>
|
||||
struct const_reference_type
|
||||
{
|
||||
typedef typename C::const_reference type;
|
||||
};
|
||||
|
||||
template <typename C>
|
||||
struct mapped_type
|
||||
{
|
||||
typedef typename C::mapped_type type;
|
||||
};
|
||||
|
||||
struct asymmetric;
|
||||
|
||||
template <typename X, typename Y>
|
||||
cant_deduce_type
|
||||
test(...); // The black hole !!!
|
||||
|
||||
template <typename X, typename Y>
|
||||
bool_value_type
|
||||
test(bool const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
int_value_type
|
||||
test(int const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
uint_value_type
|
||||
test(unsigned const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
double_value_type
|
||||
test(double const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
bool_reference_type
|
||||
test(bool&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
int_reference_type
|
||||
test(int&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
uint_reference_type
|
||||
test(unsigned&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
double_reference_type
|
||||
test(double&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<is_basic<X>, is_const<X> >
|
||||
, x_value_type
|
||||
>::type
|
||||
test(X const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
is_basic<X>
|
||||
, x_reference_type
|
||||
>::type
|
||||
test(X&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_basic<X>
|
||||
, is_const<X>
|
||||
>
|
||||
, x_const_pointer_type
|
||||
>::type
|
||||
test(X const*);
|
||||
|
||||
template <typename X, typename Y>
|
||||
x_pointer_type
|
||||
test(X*);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_basic<Y>
|
||||
, is_same<Y, asymmetric>
|
||||
, is_const<Y>
|
||||
, is_same<X, Y>
|
||||
>
|
||||
, y_value_type
|
||||
>::type
|
||||
test(Y const&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_basic<Y>
|
||||
, is_same<Y, asymmetric>
|
||||
, is_same<X, Y>
|
||||
>
|
||||
, y_reference_type
|
||||
>::type
|
||||
test(Y&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_same<Y, asymmetric>
|
||||
, is_const<Y>
|
||||
, is_same<X, Y>
|
||||
>
|
||||
, y_const_pointer_type
|
||||
>::type
|
||||
test(Y const*);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_same<Y, asymmetric>
|
||||
, is_same<X, Y>
|
||||
>
|
||||
, y_pointer_type
|
||||
>::type
|
||||
test(Y*);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_basic<typename X::value_type>
|
||||
, is_same<typename add_reference<X>::type, typename X::reference>
|
||||
>
|
||||
, container_reference_type
|
||||
>::type
|
||||
test(typename X::reference);
|
||||
|
||||
template <typename X, typename Y, typename Z>
|
||||
typename enable_if<
|
||||
mpl::and_<
|
||||
mpl::or_<is_array<X>, is_pointer<X> >
|
||||
, mpl::not_<is_basic<Z> >
|
||||
, mpl::not_<is_same<X, Z> >
|
||||
>
|
||||
, container_reference_type
|
||||
>::type
|
||||
test(Z&);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
mpl::or_<
|
||||
is_basic<typename X::value_type>
|
||||
, is_same<typename add_reference<X>::type, typename X::const_reference>
|
||||
>
|
||||
, container_const_reference_type
|
||||
>::type
|
||||
test(typename X::const_reference);
|
||||
|
||||
template <typename X, typename Y>
|
||||
typename disable_if<
|
||||
is_basic<typename X::mapped_type>
|
||||
, container_mapped_type
|
||||
>::type
|
||||
test(typename X::mapped_type);
|
||||
|
||||
template <typename X, typename Y>
|
||||
struct base_result_of
|
||||
{
|
||||
typedef typename phoenix::detail::unwrap_local_reference<X>::type x_type_;
|
||||
typedef typename phoenix::detail::unwrap_local_reference<Y>::type y_type_;
|
||||
typedef typename remove_reference<x_type_>::type x_type;
|
||||
typedef typename remove_reference<y_type_>::type y_type;
|
||||
|
||||
typedef mpl::vector20<
|
||||
mpl::identity<bool>
|
||||
, mpl::identity<int>
|
||||
, mpl::identity<unsigned>
|
||||
, mpl::identity<double>
|
||||
, mpl::identity<bool&>
|
||||
, mpl::identity<int&>
|
||||
, mpl::identity<unsigned&>
|
||||
, mpl::identity<double&>
|
||||
, mpl::identity<x_type>
|
||||
, mpl::identity<x_type&>
|
||||
, mpl::identity<x_type const*>
|
||||
, mpl::identity<x_type*>
|
||||
, mpl::identity<y_type>
|
||||
, mpl::identity<y_type&>
|
||||
, mpl::identity<y_type const*>
|
||||
, mpl::identity<y_type*>
|
||||
, reference_type<x_type>
|
||||
, const_reference_type<x_type>
|
||||
, mapped_type<x_type>
|
||||
, mpl::identity<error_cant_deduce_type>
|
||||
>
|
||||
types;
|
||||
};
|
||||
|
||||
}} // namespace boost::type_deduction_detail
|
||||
|
||||
#define BOOST_RESULT_OF_COMMON(expr, name, Y, SYMMETRY) \
|
||||
struct name \
|
||||
{ \
|
||||
typedef type_deduction_detail::base_result_of<X, Y> base_type; \
|
||||
static typename base_type::x_type x; \
|
||||
static typename base_type::y_type y; \
|
||||
\
|
||||
BOOST_STATIC_CONSTANT(int, \
|
||||
size = sizeof( \
|
||||
type_deduction_detail::test< \
|
||||
typename base_type::x_type \
|
||||
, SYMMETRY \
|
||||
>(expr) \
|
||||
)); \
|
||||
\
|
||||
BOOST_STATIC_CONSTANT(int, index = (size / sizeof(char)) - 1); \
|
||||
\
|
||||
typedef typename mpl::at_c< \
|
||||
typename base_type::types, index>::type id; \
|
||||
typedef typename id::type type; \
|
||||
};
|
||||
|
||||
#define BOOST_UNARY_RESULT_OF(expr, name) \
|
||||
template <typename X> \
|
||||
BOOST_RESULT_OF_COMMON(expr, name, \
|
||||
type_deduction_detail::asymmetric, type_deduction_detail::asymmetric)
|
||||
|
||||
#define BOOST_BINARY_RESULT_OF(expr, name) \
|
||||
template <typename X, typename Y> \
|
||||
BOOST_RESULT_OF_COMMON(expr, name, Y, typename base_type::y_type)
|
||||
|
||||
#define BOOST_ASYMMETRIC_BINARY_RESULT_OF(expr, name) \
|
||||
template <typename X, typename Y> \
|
||||
BOOST_RESULT_OF_COMMON(expr, name, Y, type_deduction_detail::asymmetric)
|
||||
|
||||
#endif
|
||||
@@ -1,13 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_FUNCTION_HPP
|
||||
#define PHOENIX_FUNCTION_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/function/function.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_FUNCTION_DETAIL_FUNCTION_CALL_HPP
|
||||
#define PHOENIX_FUNCTION_DETAIL_FUNCTION_CALL_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT), \
|
||||
"boost/spirit/home/phoenix/function/detail/function_call.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
actor<typename as_composite<detail::function_eval<N>, F
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)>::type>
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _)) const
|
||||
{
|
||||
return compose<detail::function_eval<N> >(f, BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_FUNCTION_FUNCTION_HPP
|
||||
#define PHOENIX_FUNCTION_FUNCTION_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/detail/function_eval.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename F>
|
||||
struct function
|
||||
{
|
||||
function() : f() {}
|
||||
function(F const& f_) : f(f_) {}
|
||||
|
||||
actor<typename as_composite<detail::function_eval<0>, F>::type>
|
||||
operator()() const
|
||||
{
|
||||
return compose<detail::function_eval<0> >(f);
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
actor<typename as_composite<detail::function_eval<1>, F, A0>::type>
|
||||
operator()(A0 const& _0) const
|
||||
{
|
||||
return compose<detail::function_eval<1> >(f, _0);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
actor<typename as_composite<detail::function_eval<2>, F, A0, A1>::type>
|
||||
operator()(A0 const& _0, A1 const& _1) const
|
||||
{
|
||||
return compose<detail::function_eval<2> >(f, _0, _1);
|
||||
}
|
||||
|
||||
// Bring in the rest of the function call operators
|
||||
#include <boost/spirit/home/phoenix/function/detail/function_call.hpp>
|
||||
|
||||
F f;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_FUSION_HPP
|
||||
#define PHOENIX_FUSION_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/fusion/at.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2008 Hartmut Kaiser
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_SEQUENCE_AT_HPP
|
||||
#define PHOENIX_SEQUENCE_AT_HPP
|
||||
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <int N>
|
||||
struct at_eval
|
||||
{
|
||||
template <typename Env, typename Tuple>
|
||||
struct result
|
||||
{
|
||||
typedef typename Tuple::template result<Env>::type tuple;
|
||||
typedef typename
|
||||
fusion::result_of::at_c<
|
||||
typename remove_reference<tuple>::type, N
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename Tuple>
|
||||
static RT
|
||||
eval(Env const& env, Tuple const& t)
|
||||
{
|
||||
return fusion::at_c<N>(t.eval(env));
|
||||
}
|
||||
};
|
||||
|
||||
template <int N, typename Tuple>
|
||||
inline actor<typename as_composite<at_eval<N>, Tuple>::type>
|
||||
at_c(Tuple const& tup)
|
||||
{
|
||||
return compose<at_eval<N> >(tup);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,19 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_HPP
|
||||
#define PHOENIX_OBJECT_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/new.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/construct.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/delete.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/static_cast.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/const_cast.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/dynamic_cast.hpp>
|
||||
#include <boost/spirit/home/phoenix/object/reinterpret_cast.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_CONST_CAST_HPP
|
||||
#define PHOENIX_OBJECT_CONST_CAST_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <typename T>
|
||||
struct const_cast_eval
|
||||
{
|
||||
template <typename Env, typename U>
|
||||
struct result
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename U>
|
||||
static RT
|
||||
eval(Env const& env, U& obj)
|
||||
{
|
||||
return const_cast<RT>(obj.eval(env));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
inline actor<typename as_composite<impl::const_cast_eval<T>, U>::type>
|
||||
const_cast_(U const& obj)
|
||||
{
|
||||
return compose<impl::const_cast_eval<T> >(obj);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_CONSTRUCT_HPP
|
||||
#define PHOENIX_OBJECT_CONSTRUCT_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct construct_eval
|
||||
{
|
||||
template <typename Env,
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
PHOENIX_COMPOSITE_LIMIT, typename T, fusion::void_)>
|
||||
struct result
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env>
|
||||
static RT
|
||||
eval(Env const& /*env*/)
|
||||
{
|
||||
return RT();
|
||||
}
|
||||
|
||||
template <typename RT, typename Env, typename A0>
|
||||
static RT
|
||||
eval(Env const& env, A0& _0)
|
||||
{
|
||||
return RT(_0.eval(env));
|
||||
}
|
||||
|
||||
template <typename RT
|
||||
, typename Env, typename A0, typename A1>
|
||||
static RT
|
||||
eval(Env const& env, A0& _0, A1& _1)
|
||||
{
|
||||
return RT(_0.eval(env), _1.eval(env));
|
||||
}
|
||||
|
||||
// Bring in the rest of the evals
|
||||
#include <boost/spirit/home/phoenix/object/detail/construct_eval.hpp>
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline actor<typename as_composite<detail::construct_eval<T> >::type>
|
||||
construct()
|
||||
{
|
||||
return compose<detail::construct_eval<T> >();
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline actor<typename as_composite<detail::construct_eval<T>, A0>::type>
|
||||
construct(A0 const& _0)
|
||||
{
|
||||
return compose<detail::construct_eval<T> >(_0);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1>
|
||||
inline actor<typename as_composite<detail::construct_eval<T>, A0, A1>::type>
|
||||
construct(A0 const& _0, A1 const& _1)
|
||||
{
|
||||
return compose<detail::construct_eval<T> >(_0, _1);
|
||||
}
|
||||
|
||||
// Bring in the rest of the new_ functions
|
||||
#include <boost/spirit/home/phoenix/object/detail/construct.hpp>
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,41 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_DELETE_HPP
|
||||
#define PHOENIX_OBJECT_DELETE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct delete_eval
|
||||
{
|
||||
template <typename Env, typename P>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename Args, typename Env, typename P>
|
||||
static void
|
||||
eval(Env const& env, P& p)
|
||||
{
|
||||
delete p.eval(env);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
inline actor<typename as_composite<impl::delete_eval, P>::type>
|
||||
delete_(P const& p)
|
||||
{
|
||||
return compose<impl::delete_eval>(p);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
|
||||
#define PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/object/detail/construct.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename T, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<typename as_composite<detail::construct_eval<T>
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)>::type>
|
||||
construct(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
return compose<detail::construct_eval<T> >(BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
|
||||
#define PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define PHOENIX_EVAL_ARG(z, n, data) \
|
||||
BOOST_PP_CAT(_, n).eval(env)
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/object/detail/construct_eval.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef PHOENIX_EVAL_ARG
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename RT, typename Env, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
static RT
|
||||
eval(Env const& env, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _))
|
||||
{
|
||||
return RT(BOOST_PP_ENUM(N, PHOENIX_EVAL_ARG, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OBJECT_DETAIL_NEW_HPP
|
||||
#define PHOENIX_OBJECT_DETAIL_NEW_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/object/detail/new.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename T, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline actor<typename as_composite<detail::new_eval<T>
|
||||
, BOOST_PP_ENUM_PARAMS(N, A)>::type>
|
||||
new_(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
|
||||
{
|
||||
return compose<detail::new_eval<T> >(BOOST_PP_ENUM_PARAMS(N, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
|
||||
#define PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define PHOENIX_EVAL_ARG(z, n, data) \
|
||||
BOOST_PP_CAT(_, n).eval(env)
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
|
||||
"boost/spirit/home/phoenix/object/detail/new_eval.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef PHOENIX_EVAL_ARG
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <typename RT, typename Env, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
static RT
|
||||
eval(Env const& env, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _))
|
||||
{
|
||||
return new T(BOOST_PP_ENUM(N, PHOENIX_EVAL_ARG, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_DYNAMIC_CAST_HPP
|
||||
#define PHOENIX_OBJECT_DYNAMIC_CAST_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <typename T>
|
||||
struct dynamic_cast_eval
|
||||
{
|
||||
template <typename Env, typename U>
|
||||
struct result
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename U>
|
||||
static RT
|
||||
eval(Env const& env, U& obj)
|
||||
{
|
||||
return dynamic_cast<RT>(obj.eval(env));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
inline actor<typename as_composite<impl::dynamic_cast_eval<T>, U>::type>
|
||||
dynamic_cast_(U const& obj)
|
||||
{
|
||||
return compose<impl::dynamic_cast_eval<T> >(obj);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_NEW_HPP
|
||||
#define PHOENIX_OBJECT_NEW_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct new_eval
|
||||
{
|
||||
template <typename Env,
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
PHOENIX_COMPOSITE_LIMIT, typename T, fusion::void_)>
|
||||
struct result
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env>
|
||||
static RT
|
||||
eval(Env const& /*env*/)
|
||||
{
|
||||
return new T;
|
||||
}
|
||||
|
||||
template <typename RT, typename Env, typename A0>
|
||||
static RT
|
||||
eval(Env const& env, A0& _0)
|
||||
{
|
||||
return new T(_0.eval(env));
|
||||
}
|
||||
|
||||
template <typename RT, typename Env
|
||||
, typename A0, typename A1>
|
||||
static RT
|
||||
eval(Env const& env, A0& _0, A1& _1)
|
||||
{
|
||||
return new T(_0.eval(env), _1.eval(env));
|
||||
}
|
||||
|
||||
// Bring in the rest of the evals
|
||||
#include <boost/spirit/home/phoenix/object/detail/new_eval.hpp>
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline actor<typename as_composite<detail::new_eval<T> >::type>
|
||||
new_()
|
||||
{
|
||||
return compose<detail::new_eval<T> >();
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline actor<typename as_composite<detail::new_eval<T>, A0>::type>
|
||||
new_(A0 const& _0)
|
||||
{
|
||||
return compose<detail::new_eval<T> >(_0);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1>
|
||||
inline actor<typename as_composite<detail::new_eval<T>, A0, A1>::type>
|
||||
new_(A0 const& _0, A1 const& _1)
|
||||
{
|
||||
return compose<detail::new_eval<T> >(_0, _1);
|
||||
}
|
||||
|
||||
// Bring in the rest of the new_ functions
|
||||
#include <boost/spirit/home/phoenix/object/detail/new.hpp>
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_REINTERPRET_CAST_HPP
|
||||
#define PHOENIX_OBJECT_REINTERPRET_CAST_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <typename T>
|
||||
struct reinterpret_cast_eval
|
||||
{
|
||||
template <typename Env, typename U>
|
||||
struct result
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename U>
|
||||
static RT
|
||||
eval(Env const& env, U& obj)
|
||||
{
|
||||
return reinterpret_cast<RT>(obj.eval(env));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
inline actor<typename as_composite<impl::reinterpret_cast_eval<T>, U>::type>
|
||||
reinterpret_cast_(U const& obj)
|
||||
{
|
||||
return compose<impl::reinterpret_cast_eval<T> >(obj);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OBJECT_STATIC_CAST_HPP
|
||||
#define PHOENIX_OBJECT_STATIC_CAST_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <typename T>
|
||||
struct static_cast_eval
|
||||
{
|
||||
template <typename Env, typename U>
|
||||
struct result
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename U>
|
||||
static RT
|
||||
eval(Env const& env, U& obj)
|
||||
{
|
||||
return static_cast<RT>(obj.eval(env));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
inline actor<typename as_composite<impl::static_cast_eval<T>, U>::type>
|
||||
static_cast_(U const& obj)
|
||||
{
|
||||
return compose<impl::static_cast_eval<T> >(obj);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,20 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_HPP
|
||||
#define PHOENIX_OPERATOR_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/arithmetic.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/bitwise.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/comparison.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/if_else.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/logical.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/self.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/io.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/member.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,115 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_ARITHMETIC_HPP
|
||||
#define PHOENIX_OPERATOR_ARITHMETIC_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct negate_eval;
|
||||
struct posit_eval;
|
||||
struct pre_increment_eval;
|
||||
struct pre_decrement_eval;
|
||||
struct post_increment_eval;
|
||||
struct post_decrement_eval;
|
||||
|
||||
struct plus_assign_eval;
|
||||
struct minus_assign_eval;
|
||||
struct multiplies_assign_eval;
|
||||
struct divides_assign_eval;
|
||||
struct modulus_assign_eval;
|
||||
|
||||
struct plus_eval;
|
||||
struct minus_eval;
|
||||
struct multiplies_eval;
|
||||
struct divides_eval;
|
||||
struct modulus_eval;
|
||||
|
||||
BOOST_UNARY_RESULT_OF(-x, result_of_negate)
|
||||
BOOST_UNARY_RESULT_OF(+x, result_of_posit)
|
||||
BOOST_UNARY_RESULT_OF(++x, result_of_pre_increment)
|
||||
BOOST_UNARY_RESULT_OF(--x, result_of_pre_decrement)
|
||||
BOOST_UNARY_RESULT_OF(x++, result_of_post_increment)
|
||||
BOOST_UNARY_RESULT_OF(x--, result_of_post_decrement)
|
||||
|
||||
BOOST_BINARY_RESULT_OF(x += y, result_of_plus_assign)
|
||||
BOOST_BINARY_RESULT_OF(x -= y, result_of_minus_assign)
|
||||
BOOST_BINARY_RESULT_OF(x *= y, result_of_multiplies_assign)
|
||||
BOOST_BINARY_RESULT_OF(x /= y, result_of_divides_assign)
|
||||
BOOST_BINARY_RESULT_OF(x %= y, result_of_modulus_assign)
|
||||
|
||||
BOOST_BINARY_RESULT_OF(x + y, result_of_plus)
|
||||
BOOST_BINARY_RESULT_OF(x - y, result_of_minus)
|
||||
BOOST_BINARY_RESULT_OF(x * y, result_of_multiplies)
|
||||
BOOST_BINARY_RESULT_OF(x / y, result_of_divides)
|
||||
BOOST_BINARY_RESULT_OF(x % y, result_of_modulus)
|
||||
|
||||
#define x a0.eval(env)
|
||||
#define y a1.eval(env)
|
||||
|
||||
PHOENIX_UNARY_EVAL(negate_eval, result_of_negate, -x)
|
||||
PHOENIX_UNARY_EVAL(posit_eval, result_of_posit, +x)
|
||||
PHOENIX_UNARY_EVAL(pre_increment_eval, result_of_pre_increment, ++x)
|
||||
PHOENIX_UNARY_EVAL(pre_decrement_eval, result_of_pre_decrement, --x)
|
||||
PHOENIX_UNARY_EVAL(post_increment_eval, result_of_post_increment, x++)
|
||||
PHOENIX_UNARY_EVAL(post_decrement_eval, result_of_post_decrement, x--)
|
||||
|
||||
PHOENIX_BINARY_EVAL(plus_assign_eval, result_of_plus_assign, x += y)
|
||||
PHOENIX_BINARY_EVAL(minus_assign_eval, result_of_minus_assign, x -= y)
|
||||
PHOENIX_BINARY_EVAL(multiplies_assign_eval, result_of_multiplies_assign, x *= y)
|
||||
PHOENIX_BINARY_EVAL(divides_assign_eval, result_of_divides_assign, x /= y)
|
||||
PHOENIX_BINARY_EVAL(modulus_assign_eval, result_of_modulus_assign, x %= y)
|
||||
|
||||
PHOENIX_BINARY_EVAL(plus_eval, result_of_plus, x + y)
|
||||
PHOENIX_BINARY_EVAL(minus_eval, result_of_minus, x - y)
|
||||
PHOENIX_BINARY_EVAL(multiplies_eval, result_of_multiplies, x * y)
|
||||
PHOENIX_BINARY_EVAL(divides_eval, result_of_divides, x / y)
|
||||
PHOENIX_BINARY_EVAL(modulus_eval, result_of_modulus, x % y)
|
||||
|
||||
PHOENIX_UNARY_COMPOSE(negate_eval, -)
|
||||
PHOENIX_UNARY_COMPOSE(posit_eval, +)
|
||||
PHOENIX_UNARY_COMPOSE(pre_increment_eval, ++)
|
||||
PHOENIX_UNARY_COMPOSE(pre_decrement_eval, --)
|
||||
|
||||
template <typename T0>
|
||||
inline actor<typename as_composite<post_increment_eval, actor<T0> >::type>
|
||||
operator++(actor<T0> const& a0, int) // special case
|
||||
{
|
||||
return compose<post_increment_eval>(a0);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline actor<typename as_composite<post_decrement_eval, actor<T0> >::type>
|
||||
operator--(actor<T0> const& a0, int) // special case
|
||||
{
|
||||
return compose<post_decrement_eval>(a0);
|
||||
}
|
||||
|
||||
PHOENIX_BINARY_COMPOSE(plus_assign_eval, +=)
|
||||
PHOENIX_BINARY_COMPOSE(minus_assign_eval, -=)
|
||||
PHOENIX_BINARY_COMPOSE(multiplies_assign_eval, *=)
|
||||
PHOENIX_BINARY_COMPOSE(divides_assign_eval, /=)
|
||||
PHOENIX_BINARY_COMPOSE(modulus_assign_eval, %=)
|
||||
|
||||
PHOENIX_BINARY_COMPOSE(plus_eval, +)
|
||||
PHOENIX_BINARY_COMPOSE(minus_eval, -)
|
||||
PHOENIX_BINARY_COMPOSE(multiplies_eval, *)
|
||||
PHOENIX_BINARY_COMPOSE(divides_eval, /)
|
||||
PHOENIX_BINARY_COMPOSE(modulus_eval, %)
|
||||
|
||||
#undef x
|
||||
#undef y
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,91 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_BITWISE_HPP
|
||||
#define PHOENIX_OPERATOR_BITWISE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_compose.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4800)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct invert_eval;
|
||||
|
||||
struct and_assign_eval;
|
||||
struct or_assign_eval;
|
||||
struct xor_assign_eval;
|
||||
struct shift_left_assign_eval;
|
||||
struct shift_right_assign_eval;
|
||||
|
||||
struct and_eval;
|
||||
struct or_eval;
|
||||
struct xor_eval;
|
||||
struct shift_left_eval;
|
||||
struct shift_right_eval;
|
||||
|
||||
BOOST_UNARY_RESULT_OF(~x, result_of_invert)
|
||||
|
||||
BOOST_BINARY_RESULT_OF(x &= y, result_of_and_assign)
|
||||
BOOST_BINARY_RESULT_OF(x |= y, result_of_or_assign)
|
||||
BOOST_BINARY_RESULT_OF(x ^= y, result_of_xor_assign)
|
||||
BOOST_BINARY_RESULT_OF(x <<= y, result_of_shift_left_assign)
|
||||
BOOST_BINARY_RESULT_OF(x >>= y, result_of_shift_right_assign)
|
||||
|
||||
BOOST_BINARY_RESULT_OF(x & y, result_of_and)
|
||||
BOOST_BINARY_RESULT_OF(x | y, result_of_or)
|
||||
BOOST_BINARY_RESULT_OF(x ^ y, result_of_xor)
|
||||
BOOST_BINARY_RESULT_OF(x << y, result_of_shift_left)
|
||||
BOOST_BINARY_RESULT_OF(x >> y, result_of_shift_right)
|
||||
|
||||
#define x a0.eval(env)
|
||||
#define y a1.eval(env)
|
||||
|
||||
PHOENIX_UNARY_EVAL(invert_eval, result_of_invert, ~x)
|
||||
PHOENIX_UNARY_COMPOSE(invert_eval, ~)
|
||||
|
||||
PHOENIX_BINARY_EVAL(and_assign_eval, result_of_and_assign, x &= y)
|
||||
PHOENIX_BINARY_EVAL(or_assign_eval, result_of_or_assign, x |= y)
|
||||
PHOENIX_BINARY_EVAL(xor_assign_eval, result_of_xor_assign, x ^= y)
|
||||
PHOENIX_BINARY_EVAL(shift_left_assign_eval, result_of_shift_left_assign, x <<= y)
|
||||
PHOENIX_BINARY_EVAL(shift_right_assign_eval, result_of_shift_right_assign, x >>= y)
|
||||
|
||||
PHOENIX_BINARY_EVAL(and_eval, result_of_and, x & y)
|
||||
PHOENIX_BINARY_EVAL(or_eval, result_of_or, x | y)
|
||||
PHOENIX_BINARY_EVAL(xor_eval, result_of_xor, x ^ y)
|
||||
PHOENIX_BINARY_EVAL(shift_left_eval, result_of_shift_left, x << y)
|
||||
PHOENIX_BINARY_EVAL(shift_right_eval, result_of_shift_right, x >> y)
|
||||
|
||||
PHOENIX_BINARY_COMPOSE(and_assign_eval, &=)
|
||||
PHOENIX_BINARY_COMPOSE(or_assign_eval, |=)
|
||||
PHOENIX_BINARY_COMPOSE(xor_assign_eval, ^=)
|
||||
PHOENIX_BINARY_COMPOSE(shift_left_assign_eval, <<=)
|
||||
PHOENIX_BINARY_COMPOSE(shift_right_assign_eval, >>=)
|
||||
|
||||
PHOENIX_BINARY_COMPOSE(and_eval, &)
|
||||
PHOENIX_BINARY_COMPOSE(or_eval, |)
|
||||
PHOENIX_BINARY_COMPOSE(xor_eval, ^)
|
||||
PHOENIX_BINARY_COMPOSE(shift_left_eval, <<)
|
||||
PHOENIX_BINARY_COMPOSE(shift_right_eval, >>)
|
||||
|
||||
#undef x
|
||||
#undef y
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_COMPARISON_HPP
|
||||
#define PHOENIX_OPERATOR_COMPARISON_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct equal_to_eval;
|
||||
struct not_equal_to_eval;
|
||||
struct less_eval;
|
||||
struct less_equal_eval;
|
||||
struct greater_eval;
|
||||
struct greater_equal_eval;
|
||||
|
||||
BOOST_BINARY_RESULT_OF(x == y, result_of_equal_to)
|
||||
BOOST_BINARY_RESULT_OF(x != y, result_of_not_equal_to)
|
||||
BOOST_BINARY_RESULT_OF(x < y, result_of_less)
|
||||
BOOST_BINARY_RESULT_OF(x <= y, result_of_less_equal)
|
||||
BOOST_BINARY_RESULT_OF(x > y, result_of_greater)
|
||||
BOOST_BINARY_RESULT_OF(x >= y, result_of_greater_equal)
|
||||
|
||||
#define x a0.eval(env)
|
||||
#define y a1.eval(env)
|
||||
|
||||
PHOENIX_BINARY_EVAL(equal_to_eval, result_of_equal_to, x == y)
|
||||
PHOENIX_BINARY_EVAL(not_equal_to_eval, result_of_not_equal_to, x != y)
|
||||
PHOENIX_BINARY_EVAL(less_eval, result_of_less, x < y)
|
||||
PHOENIX_BINARY_EVAL(less_equal_eval, result_of_less_equal, x <= y)
|
||||
PHOENIX_BINARY_EVAL(greater_eval, result_of_greater, x > y)
|
||||
PHOENIX_BINARY_EVAL(greater_equal_eval, result_of_greater_equal, x >= y)
|
||||
|
||||
PHOENIX_BINARY_COMPOSE(equal_to_eval, ==)
|
||||
PHOENIX_BINARY_COMPOSE(not_equal_to_eval, !=)
|
||||
PHOENIX_BINARY_COMPOSE(less_eval, <)
|
||||
PHOENIX_BINARY_COMPOSE(less_equal_eval, <=)
|
||||
PHOENIX_BINARY_COMPOSE(greater_eval, >)
|
||||
PHOENIX_BINARY_COMPOSE(greater_equal_eval, >=)
|
||||
|
||||
#undef x
|
||||
#undef y
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,32 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_DETAIL_BINARY_COMPOSE_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_BINARY_COMPOSE_HPP
|
||||
|
||||
#define PHOENIX_BINARY_COMPOSE(eval_name, op) \
|
||||
template <typename T0, typename T1> \
|
||||
inline actor<typename as_composite<eval_name, actor<T0>, actor<T1> >::type> \
|
||||
operator op (actor<T0> const& a0, actor<T1> const& a1) \
|
||||
{ \
|
||||
return compose<eval_name>(a0, a1); \
|
||||
} \
|
||||
\
|
||||
template <typename T0, typename T1> \
|
||||
inline actor<typename as_composite<eval_name, actor<T0>, T1>::type> \
|
||||
operator op (actor<T0> const& a0, T1 const& a1) \
|
||||
{ \
|
||||
return compose<eval_name>(a0, a1); \
|
||||
} \
|
||||
\
|
||||
template <typename T0, typename T1> \
|
||||
inline actor<typename as_composite<eval_name, T0, actor<T1> >::type> \
|
||||
operator op (T0 const& a0, actor<T1> const& a1) \
|
||||
{ \
|
||||
return compose<eval_name>(a0, a1); \
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_DETAIL_BINARY_EVAL_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_BINARY_EVAL_HPP
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
#define PHOENIX_BINARY_EVAL(eval_name, op_result, expr) \
|
||||
struct eval_name \
|
||||
{ \
|
||||
template <typename Env, typename A0, typename A1> \
|
||||
struct result \
|
||||
{ \
|
||||
typedef typename A0::template result<Env>::type x_type; \
|
||||
typedef typename A1::template result<Env>::type y_type; \
|
||||
\
|
||||
typedef typename \
|
||||
mpl::eval_if< \
|
||||
mpl::or_<is_actor<x_type>, is_actor<y_type> > \
|
||||
, re_curry<eval_name, x_type, y_type> \
|
||||
, op_result<x_type, y_type> \
|
||||
>::type \
|
||||
type; \
|
||||
}; \
|
||||
\
|
||||
template <typename RT, typename Env, typename A0, typename A1> \
|
||||
static RT \
|
||||
eval(Env const& env, A0& a0, A1& a1) \
|
||||
{ \
|
||||
return expr; \
|
||||
} \
|
||||
};
|
||||
|
||||
#undef x
|
||||
#undef y
|
||||
#endif
|
||||
@@ -1,78 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_DETAIL_IO_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_IO_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/operator/bitwise.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/reference.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
typedef char(&no)[1];
|
||||
typedef char(&yes)[2];
|
||||
|
||||
template <typename CharType, typename CharTrait>
|
||||
yes ostream_test(std::basic_ostream<CharType, CharTrait>*);
|
||||
no ostream_test(...);
|
||||
|
||||
template <typename CharType, typename CharTrait>
|
||||
yes istream_test(std::basic_istream<CharType, CharTrait>*);
|
||||
no istream_test(...);
|
||||
|
||||
template <typename T>
|
||||
struct is_ostream
|
||||
{
|
||||
static T x;
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = sizeof(detail::ostream_test(boost::addressof(x))) == sizeof(yes));
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_istream
|
||||
{
|
||||
static T x;
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = sizeof(detail::istream_test(boost::addressof(x))) == sizeof(yes));
|
||||
};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct enable_if_ostream :
|
||||
enable_if<
|
||||
detail::is_ostream<T0>
|
||||
, actor<
|
||||
typename as_composite<
|
||||
shift_left_eval
|
||||
, actor<reference<T0> >
|
||||
, actor<T1>
|
||||
>::type
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct enable_if_istream :
|
||||
enable_if<
|
||||
detail::is_istream<T0>
|
||||
, actor<
|
||||
typename as_composite<
|
||||
shift_right_eval
|
||||
, actor<reference<T0> >
|
||||
, actor<T1>
|
||||
>::type
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
typedef std::ios_base& (*iomanip_type)(std::ios_base&);
|
||||
typedef std::istream& (*imanip_type)(std::istream&);
|
||||
typedef std::ostream& (*omanip_type)(std::ostream&);
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -1,76 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_EVAL_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_EVAL_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
|
||||
#include <boost/mpl/void.hpp>
|
||||
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
|
||||
#include <boost/get_pointer.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_return.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
|
||||
struct mem_fun_ptr_eval
|
||||
{
|
||||
template<typename Env, typename PtrActor, typename MemFunPtrActor,
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_SUB(PHOENIX_MEMBER_LIMIT, 2), typename Arg, mpl::void_)>
|
||||
|
||||
struct result
|
||||
: detail::mem_fun_ptr_return<typename eval_result<MemFunPtrActor, Env>::type> { };
|
||||
|
||||
template<typename Rt, typename Env, typename PtrActor, typename MemFunPtrActor>
|
||||
static typename result<Env,PtrActor,MemFunPtrActor>::type
|
||||
eval(const Env& env, PtrActor& ptrActor, MemFunPtrActor& memFunPtrActor)
|
||||
{
|
||||
return (get_pointer(ptrActor.eval(env))->*memFunPtrActor.eval(env))();
|
||||
}
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
#define PHOENIX_EVAL_ARG(z,n,_) arg ## n.eval(env)
|
||||
|
||||
template<typename Rt, typename Env, typename PtrActor, typename MemFunPtrActor,
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Arg)>
|
||||
static typename result<Env,PtrActor,MemFunPtrActor, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION,Arg)>::type
|
||||
eval(const Env& env, PtrActor& ptrActor, MemFunPtrActor& memFunPtrActor,
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, Arg, & arg))
|
||||
{
|
||||
return (get_pointer(ptrActor.eval(env))->*memFunPtrActor.eval(env))(
|
||||
BOOST_PP_ENUM(PHOENIX_ITERATION,PHOENIX_EVAL_ARG,_));
|
||||
}
|
||||
|
||||
#undef PHOENIX_EVAL_ARG
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#endif
|
||||
@@ -1,69 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_GEN_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_GEN_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/as_actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
template<typename Actor, typename MemFunPtr>
|
||||
struct mem_fun_ptr_gen
|
||||
{
|
||||
mem_fun_ptr_gen(
|
||||
const Actor& actor, MemFunPtr memFunPtr)
|
||||
: mActor(actor), mMemFunPtr(memFunPtr) { }
|
||||
|
||||
actor<typename as_composite<mem_fun_ptr_eval, Actor, typename as_actor<MemFunPtr>::type>::type>
|
||||
operator()() const
|
||||
{
|
||||
return compose<mem_fun_ptr_eval>(
|
||||
mActor, as_actor<MemFunPtr>::convert(mMemFunPtr));
|
||||
}
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
Actor mActor;
|
||||
MemFunPtr mMemFunPtr;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Arg)>
|
||||
actor<typename as_composite<
|
||||
mem_fun_ptr_eval, Actor, typename as_actor<MemFunPtr>::type,
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, Arg)>::type>
|
||||
operator()(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, const Arg, &arg)) const
|
||||
{
|
||||
return compose<mem_fun_ptr_eval>(
|
||||
mActor, as_actor<MemFunPtr>::convert(mMemFunPtr),
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, arg));
|
||||
}
|
||||
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_RETURN_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_RETURN_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
namespace detail
|
||||
{
|
||||
template<typename MemFunPtr>
|
||||
struct mem_fun_ptr_return;
|
||||
|
||||
template<typename Ret, typename Class>
|
||||
struct mem_fun_ptr_return<Ret (Class::*)()>
|
||||
{
|
||||
typedef Ret type;
|
||||
};
|
||||
|
||||
template<typename Ret, typename Class>
|
||||
struct mem_fun_ptr_return<Ret (Class::*)() const>
|
||||
{
|
||||
typedef Ret type;
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, PHOENIX_MEMBER_LIMIT, "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_return.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
template<typename Ret, typename Class,
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename T)>
|
||||
struct mem_fun_ptr_return<Ret (Class::*)(BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, T))>
|
||||
{
|
||||
typedef Ret type;
|
||||
};
|
||||
|
||||
template<typename Ret, typename Class,
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename T)>
|
||||
struct mem_fun_ptr_return<Ret (Class::*)(BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, T)) const>
|
||||
{
|
||||
typedef Ret type;
|
||||
};
|
||||
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_DETAIL_UNARY_COMPOSE_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_UNARY_COMPOSE_HPP
|
||||
|
||||
#define PHOENIX_UNARY_COMPOSE(eval_name, op) \
|
||||
template <typename T0> \
|
||||
inline actor<typename as_composite<eval_name, actor<T0> >::type> \
|
||||
operator op (actor<T0> const& a0) \
|
||||
{ \
|
||||
return compose<eval_name>(a0); \
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_DETAIL_UNARY_EVAL_HPP
|
||||
#define PHOENIX_OPERATOR_DETAIL_UNARY_EVAL_HPP
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
#define PHOENIX_UNARY_EVAL(eval_name, op_result, expr) \
|
||||
struct eval_name \
|
||||
{ \
|
||||
template <typename Env, typename A0> \
|
||||
struct result \
|
||||
{ \
|
||||
typedef typename A0::template result<Env>::type x_type; \
|
||||
\
|
||||
typedef typename \
|
||||
mpl::eval_if< \
|
||||
is_actor<x_type> \
|
||||
, re_curry<eval_name, x_type> \
|
||||
, op_result<x_type> \
|
||||
>::type \
|
||||
type; \
|
||||
}; \
|
||||
\
|
||||
template <typename RT, typename Env, typename A0> \
|
||||
static RT \
|
||||
eval(Env const& env, A0& a0) \
|
||||
{ \
|
||||
return expr; \
|
||||
} \
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_IF_ELSE_HPP
|
||||
#define PHOENIX_OPERATOR_IF_ELSE_HPP
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
BOOST_BINARY_RESULT_OF(true ? x : y, result_of_if_else)
|
||||
|
||||
struct if_else_op_eval
|
||||
{
|
||||
template <
|
||||
typename Env
|
||||
, typename Cond
|
||||
, typename Then
|
||||
, typename Else
|
||||
>
|
||||
struct result
|
||||
{
|
||||
typedef typename Then::template result<Env>::type then_type;
|
||||
typedef typename Else::template result<Env>::type else_type;
|
||||
|
||||
typedef typename
|
||||
result_of_if_else<then_type, else_type>::type
|
||||
ite_result;
|
||||
|
||||
// Note: c ? x : y can return an lvalue! Allow if_else_op_eval
|
||||
// to return an lvalue IFF then_type and else_type are both lvalues
|
||||
// with the same type.
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
mpl::and_<
|
||||
is_same<then_type, else_type>
|
||||
, is_reference<then_type>
|
||||
>
|
||||
, ite_result
|
||||
, typename remove_reference<ite_result>::type
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT
|
||||
, typename Env
|
||||
, typename Cond
|
||||
, typename Then
|
||||
, typename Else
|
||||
>
|
||||
static RT
|
||||
eval(Env const& env, Cond& cond, Then& then, Else& else_)
|
||||
{
|
||||
return cond.eval(env) ? then.eval(env) : else_.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cond, typename Then, typename Else>
|
||||
inline actor<typename as_composite<if_else_op_eval, Cond, Then, Else>::type>
|
||||
if_else(Cond const& cond, Then const& then, Else const& else_)
|
||||
{
|
||||
return compose<if_else_op_eval>(cond, then, else_);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_IO_HPP
|
||||
#define PHOENIX_OPERATOR_IO_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/operator/detail/io.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// overloads for std::basic_ostream and std::basic_istream
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T0, typename T1>
|
||||
inline typename detail::enable_if_ostream<T0, T1>::type
|
||||
operator<<(T0& a0, actor<T1> const& a1)
|
||||
{
|
||||
return compose<shift_left_eval>(phoenix::ref(a0), a1);
|
||||
}
|
||||
|
||||
template <typename T0, typename T1>
|
||||
inline typename detail::enable_if_istream<T0, T1>::type
|
||||
operator>>(T0& a0, actor<T1> const& a1)
|
||||
{
|
||||
return compose<shift_right_eval>(phoenix::ref(a0), a1);
|
||||
}
|
||||
|
||||
// resolve ambiguities with fusion.
|
||||
template <typename T1>
|
||||
inline typename detail::enable_if_ostream<std::ostream, T1>::type
|
||||
operator<<(std::ostream& a0, actor<T1> const& a1)
|
||||
{
|
||||
return compose<shift_left_eval>(phoenix::ref(a0), a1);
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
inline typename detail::enable_if_istream<std::istream, T1>::type
|
||||
operator>>(std::istream& a0, actor<T1> const& a1)
|
||||
{
|
||||
return compose<shift_right_eval>(phoenix::ref(a0), a1);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// overloads for I/O manipulators.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T0>
|
||||
inline actor<typename as_composite<
|
||||
shift_left_eval, actor<T0>, detail::omanip_type>::type>
|
||||
operator<<(actor<T0> const& a0, detail::omanip_type a1)
|
||||
{
|
||||
return compose<shift_left_eval>(a0, a1);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline actor<typename as_composite<
|
||||
shift_left_eval, actor<T0>, detail::iomanip_type>::type>
|
||||
operator<<(actor<T0> const& a0, detail::iomanip_type a1)
|
||||
{
|
||||
return compose<shift_left_eval>(a0, a1);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline actor<typename as_composite<
|
||||
shift_right_eval, actor<T0>, detail::imanip_type>::type>
|
||||
operator>>(actor<T0> const& a0, detail::imanip_type a1)
|
||||
{
|
||||
return compose<shift_right_eval>(a0, a1);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline actor<typename as_composite<
|
||||
shift_right_eval, actor<T0>, detail::iomanip_type>::type>
|
||||
operator>>(actor<T0> const& a0, detail::iomanip_type a1)
|
||||
{
|
||||
return compose<shift_right_eval>(a0, a1);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_LOGICAL_HPP
|
||||
#define PHOENIX_OPERATOR_LOGICAL_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct logical_not_eval;
|
||||
struct logical_and_eval;
|
||||
struct logical_or_eval;
|
||||
|
||||
BOOST_UNARY_RESULT_OF(!x, result_of_logical_not)
|
||||
BOOST_BINARY_RESULT_OF(x && y, result_of_logical_and)
|
||||
BOOST_BINARY_RESULT_OF(x || y, result_of_logical_or)
|
||||
|
||||
#define x a0.eval(env)
|
||||
#define y a1.eval(env)
|
||||
|
||||
PHOENIX_UNARY_EVAL(logical_not_eval, result_of_logical_not, !x)
|
||||
PHOENIX_BINARY_EVAL(logical_and_eval, result_of_logical_and, x && y)
|
||||
PHOENIX_BINARY_EVAL(logical_or_eval, result_of_logical_or, x || y)
|
||||
|
||||
PHOENIX_UNARY_COMPOSE(logical_not_eval, !)
|
||||
PHOENIX_BINARY_COMPOSE(logical_and_eval, &&)
|
||||
PHOENIX_BINARY_COMPOSE(logical_or_eval, ||)
|
||||
|
||||
#undef x
|
||||
#undef y
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,145 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_MEMBER_HPP
|
||||
#define PHOENIX_OPERATOR_MEMBER_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_member_pointer.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#include <boost/get_pointer.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
template<typename T> class shared_ptr;
|
||||
template<typename T> class scoped_ptr;
|
||||
|
||||
namespace phoenix {
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct member_type;
|
||||
|
||||
template<typename Class, typename MemberType>
|
||||
struct member_type<MemberType (Class::*)>
|
||||
{
|
||||
typedef MemberType type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template<typename T>
|
||||
struct pointed_type;
|
||||
|
||||
template<typename T>
|
||||
struct pointed_type<T*>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct pointed_type<shared_ptr<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct pointed_type<scoped_ptr<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct pointed_type<std::auto_ptr<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}
|
||||
|
||||
struct member_object_eval
|
||||
{
|
||||
template<typename Env, typename PtrActor, typename MemPtrActor>
|
||||
struct result
|
||||
{
|
||||
typedef typename detail::member_type<
|
||||
typename eval_result<MemPtrActor, Env>::type>::type member_type;
|
||||
|
||||
typedef typename meta::pointed_type<
|
||||
typename remove_reference<
|
||||
typename eval_result<PtrActor, Env>::type>::type>::type object_type;
|
||||
|
||||
typedef typename add_reference<
|
||||
typename mpl::eval_if<
|
||||
is_const<object_type>,
|
||||
add_const<member_type>,
|
||||
mpl::identity<member_type> >::type>::type type;
|
||||
};
|
||||
|
||||
template<typename Rt, typename Env, typename PtrActor, typename MemPtrActor>
|
||||
static typename result<Env,PtrActor,MemPtrActor>::type
|
||||
eval(const Env& env, PtrActor& ptrActor, MemPtrActor& memPtrActor)
|
||||
{
|
||||
return get_pointer(ptrActor.eval(env))->*memPtrActor.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
namespace member_object
|
||||
{
|
||||
template<typename T0, typename MemObjPtr>
|
||||
typename enable_if<
|
||||
mpl::and_<is_member_pointer<MemObjPtr>, mpl::not_<is_member_function_pointer<MemObjPtr> > >,
|
||||
actor<typename as_composite<
|
||||
member_object_eval, actor<T0>,
|
||||
typename as_actor<MemObjPtr>::type>::type> >::type
|
||||
operator->*(
|
||||
const actor<T0>& ptrActor,
|
||||
MemObjPtr memObjPtr)
|
||||
{
|
||||
return compose<member_object_eval>(
|
||||
ptrActor,
|
||||
as_actor<MemObjPtr>::convert(memObjPtr));
|
||||
}
|
||||
}
|
||||
|
||||
namespace member_function
|
||||
{
|
||||
template<typename T0, typename MemFunPtr>
|
||||
typename enable_if<
|
||||
is_member_function_pointer<MemFunPtr>,
|
||||
mem_fun_ptr_gen<actor<T0>, MemFunPtr> >::type
|
||||
operator->*(const actor<T0>& ptrActor, MemFunPtr memFunPtr)
|
||||
{
|
||||
return mem_fun_ptr_gen<actor<T0>, MemFunPtr>(
|
||||
ptrActor, memFunPtr);
|
||||
}
|
||||
}
|
||||
|
||||
using member_object::operator->*;
|
||||
using member_function::operator->*;
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,75 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_OPERATOR_SELF_HPP
|
||||
#define PHOENIX_OPERATOR_SELF_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/unary_compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator/detail/binary_compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct reference_eval;
|
||||
struct dereference_eval;
|
||||
struct assign_eval;
|
||||
struct index_eval;
|
||||
|
||||
BOOST_UNARY_RESULT_OF(&x, result_of_reference)
|
||||
BOOST_UNARY_RESULT_OF(*x, result_of_dereference)
|
||||
BOOST_BINARY_RESULT_OF(x = y, result_of_assign)
|
||||
BOOST_ASYMMETRIC_BINARY_RESULT_OF(x[y], result_of_index)
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename T0, typename T1>
|
||||
struct make_assign_composite
|
||||
{
|
||||
typedef actor<typename as_composite<assign_eval, T0, T1>::type> type;
|
||||
};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct make_index_composite
|
||||
{
|
||||
typedef actor<typename as_composite<index_eval, T0, T1>::type> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
template <typename T1>
|
||||
typename detail::make_assign_composite<actor<Base>, T1>::type
|
||||
actor<Base>::operator=(T1 const& a1) const
|
||||
{
|
||||
return compose<assign_eval>(*this, a1);
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
template <typename T1>
|
||||
typename detail::make_index_composite<actor<Base>, T1>::type
|
||||
actor<Base>::operator[](T1 const& a1) const
|
||||
{
|
||||
return compose<index_eval>(*this, a1);
|
||||
}
|
||||
|
||||
#define x a0.eval(env)
|
||||
#define y a1.eval(env)
|
||||
|
||||
PHOENIX_UNARY_EVAL(reference_eval, result_of_reference, &x)
|
||||
PHOENIX_UNARY_EVAL(dereference_eval, result_of_dereference, *x)
|
||||
PHOENIX_UNARY_COMPOSE(reference_eval, &)
|
||||
PHOENIX_UNARY_COMPOSE(dereference_eval, *)
|
||||
|
||||
PHOENIX_BINARY_EVAL(assign_eval, result_of_assign, x = y)
|
||||
PHOENIX_BINARY_EVAL(index_eval, result_of_index, x[y])
|
||||
}}
|
||||
|
||||
#undef x
|
||||
#undef y
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_SCOPE_HPP
|
||||
#define PHOENIX_SCOPE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/scoped_environment.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/lambda.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/let.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/local_variable.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,57 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
// Allow multiple inclusion. let.hpp and lambda.hpp will have the guards
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
#define PHOENIX_LOCAL_GEN_PARAM(z, n, data) \
|
||||
actor<composite<assign_eval \
|
||||
, fusion::vector<local_variable<K##n>, V##n> > > const& a##n
|
||||
|
||||
#define PHOENIX_LOCAL_GEN_ACTOR(z, n, data) \
|
||||
fusion::at_c<1>(a##n)
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, PHOENIX_LOCAL_LIMIT, \
|
||||
"boost/spirit/home/phoenix/scope/detail/local_gen.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef PHOENIX_LOCAL_GEN_PARAM
|
||||
#undef PHOENIX_LOCAL_GEN_ACTOR
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS(N, typename K)
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename V)
|
||||
>
|
||||
PHOENIX_LOCAL_GEN_NAME<
|
||||
fusion::vector<BOOST_PP_ENUM_PARAMS(N, V)>
|
||||
, detail::map_local_index_to_tuple<BOOST_PP_ENUM_PARAMS(N, K)>
|
||||
>
|
||||
operator()(
|
||||
BOOST_PP_ENUM(N, PHOENIX_LOCAL_GEN_PARAM, _)
|
||||
) const
|
||||
{
|
||||
return fusion::vector<BOOST_PP_ENUM_PARAMS(N, V)>(
|
||||
BOOST_PP_ENUM(N, PHOENIX_LOCAL_GEN_ACTOR, _));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
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 PHOENIX_SCOPE_DETAIL_LOCAL_VARIABLE_HPP
|
||||
#define PHOENIX_SCOPE_DETAIL_LOCAL_VARIABLE_HPP
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/fusion/include/value_at.hpp>
|
||||
#include <boost/preprocessor/enum.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
|
||||
#define PHOENIX_MAP_LOCAL_TEMPLATE_PARAM(z, n, data) \
|
||||
typename T##n = unused<n>
|
||||
|
||||
#define PHOENIX_MAP_LOCAL_DISPATCH(z, n, data) \
|
||||
typedef char(&result##n)[n+2]; \
|
||||
static result##n get(T##n*);
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Env, typename OuterEnv, typename Locals, typename Map>
|
||||
struct scoped_environment;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Env>
|
||||
struct initialize_local
|
||||
{
|
||||
template <class F>
|
||||
struct result;
|
||||
|
||||
template <class F, class Actor>
|
||||
struct result<F(Actor)>
|
||||
{
|
||||
typedef typename remove_reference<Actor>::type actor_type;
|
||||
typedef typename actor_type::template result<Env>::type type;
|
||||
};
|
||||
|
||||
initialize_local(Env const& env)
|
||||
: env(env) {}
|
||||
|
||||
template <typename Actor>
|
||||
typename result<initialize_local(Actor)>::type
|
||||
operator()(Actor const& actor) const
|
||||
{
|
||||
return actor.eval(env);
|
||||
}
|
||||
|
||||
Env const& env;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
initialize_local& operator= (initialize_local const&);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_scoped_environment : mpl::false_ {};
|
||||
|
||||
template <typename Env, typename OuterEnv, typename Locals, typename Map>
|
||||
struct is_scoped_environment<scoped_environment<Env, OuterEnv, Locals, Map> >
|
||||
: mpl::true_ {};
|
||||
|
||||
template <int N>
|
||||
struct unused;
|
||||
|
||||
template <BOOST_PP_ENUM(
|
||||
PHOENIX_LOCAL_LIMIT, PHOENIX_MAP_LOCAL_TEMPLATE_PARAM, _)>
|
||||
struct map_local_index_to_tuple
|
||||
{
|
||||
typedef char(¬_found)[1];
|
||||
static not_found get(...);
|
||||
|
||||
BOOST_PP_REPEAT(PHOENIX_LOCAL_LIMIT, PHOENIX_MAP_LOCAL_DISPATCH, _)
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
T* generate_pointer();
|
||||
|
||||
template <typename Map, typename Tag>
|
||||
struct get_index
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int,
|
||||
value = (
|
||||
static_cast<int>((sizeof(Map::get(generate_pointer<Tag>()))) / sizeof(char)) - 2
|
||||
));
|
||||
|
||||
// if value == -1, Tag is not found
|
||||
typedef mpl::int_<value> type;
|
||||
};
|
||||
|
||||
template <typename Local, typename Env>
|
||||
struct apply_local;
|
||||
|
||||
template <typename Local, typename Env>
|
||||
struct outer_local
|
||||
{
|
||||
typedef typename
|
||||
apply_local<Local, typename Env::outer_env_type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Locals, typename Index>
|
||||
struct get_local_or_void
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
mpl::less<Index, mpl::size<Locals> >
|
||||
, fusion::result_of::at<Locals, Index>
|
||||
, mpl::identity<fusion::void_>
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Local, typename Env, typename Index>
|
||||
struct get_local_from_index
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
mpl::equal_to<Index, mpl::int_<-1> >
|
||||
, outer_local<Local, Env>
|
||||
, get_local_or_void<typename Env::locals_type, Index>
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Local, typename Env>
|
||||
struct get_local
|
||||
{
|
||||
typedef typename
|
||||
get_index<
|
||||
typename Env::map_type, typename Local::key_type>::type
|
||||
index_type;
|
||||
|
||||
typedef typename
|
||||
get_local_from_index<Local, Env, index_type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Local, typename Env>
|
||||
struct apply_local
|
||||
{
|
||||
// $$$ TODO: static assert that Env is a scoped_environment $$$
|
||||
typedef typename get_local<Local, Env>::type type;
|
||||
};
|
||||
|
||||
template <typename Key>
|
||||
struct eval_local
|
||||
{
|
||||
template <typename RT, typename Env, typename Index>
|
||||
static RT
|
||||
get(Env const& env, Index, mpl::false_)
|
||||
{
|
||||
return RT(fusion::at<Index>(env.locals));
|
||||
}
|
||||
|
||||
template <typename RT, typename Env, typename Index>
|
||||
static RT
|
||||
get(Env const& env, Index index, mpl::true_)
|
||||
{
|
||||
typedef typename
|
||||
get_index<typename Env::outer_env_type::map_type, Key>::type
|
||||
index_type;
|
||||
|
||||
return get<RT>(
|
||||
env.outer_env
|
||||
, index_type()
|
||||
, mpl::equal_to<index_type, mpl::int_<-1> >());
|
||||
}
|
||||
|
||||
template <typename RT, typename Env, typename Index>
|
||||
static RT
|
||||
get(Env const& env, Index index)
|
||||
{
|
||||
return get<RT>(
|
||||
env
|
||||
, index
|
||||
, mpl::equal_to<Index, mpl::int_<-1> >());
|
||||
}
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#undef PHOENIX_MAP_LOCAL_TEMPLATE_PARAM
|
||||
#undef PHOENIX_MAP_LOCAL_DISPATCH
|
||||
#endif
|
||||
@@ -1,193 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
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 PHOENIX_SCOPE_DYNAMIC_HPP
|
||||
#define PHOENIX_SCOPE_DYNAMIC_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#define PHOENIX_DYNAMIC_MEMBER(z, n, data) \
|
||||
typedef actor<dynamic_member<n, self_type> > \
|
||||
BOOST_PP_CAT(member, BOOST_PP_INC(n));
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename DynamicScope>
|
||||
struct dynamic_frame : noncopyable
|
||||
{
|
||||
typedef typename DynamicScope::tuple_type tuple_type;
|
||||
|
||||
dynamic_frame(DynamicScope const& scope)
|
||||
: tuple()
|
||||
, save(scope.frame)
|
||||
, scope(scope)
|
||||
{
|
||||
scope.frame = this;
|
||||
}
|
||||
|
||||
template <typename Tuple>
|
||||
dynamic_frame(DynamicScope const& scope, Tuple const& init)
|
||||
: tuple(init)
|
||||
, save(scope.frame)
|
||||
, scope(scope)
|
||||
{
|
||||
scope.frame = this;
|
||||
}
|
||||
|
||||
~dynamic_frame()
|
||||
{
|
||||
scope.frame = save;
|
||||
}
|
||||
|
||||
tuple_type& data() { return tuple; }
|
||||
tuple_type const& data() const { return tuple; }
|
||||
|
||||
private:
|
||||
|
||||
tuple_type tuple;
|
||||
dynamic_frame* save;
|
||||
DynamicScope const& scope;
|
||||
};
|
||||
|
||||
template <int N, typename DynamicScope>
|
||||
struct dynamic_member
|
||||
{
|
||||
typedef mpl::false_ no_nullary;
|
||||
typedef typename DynamicScope::tuple_type tuple_type;
|
||||
|
||||
dynamic_member(DynamicScope const& scope)
|
||||
: scope(scope) {}
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
fusion::result_of::at_c<tuple_type, N>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& /*env*/) const
|
||||
{
|
||||
BOOST_ASSERT(scope.frame != 0);
|
||||
return fusion::at_c<N>(scope.frame->data());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
DynamicScope const& scope;
|
||||
};
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(PHOENIX_DYNAMIC_LIMIT, typename T, void_)>
|
||||
struct dynamic : noncopyable
|
||||
{
|
||||
typedef fusion::vector<BOOST_PP_ENUM_PARAMS(PHOENIX_DYNAMIC_LIMIT, T)> tuple_type;
|
||||
typedef dynamic<BOOST_PP_ENUM_PARAMS(PHOENIX_DYNAMIC_LIMIT, T)> self_type;
|
||||
typedef dynamic_frame<self_type> dynamic_frame_type;
|
||||
|
||||
dynamic()
|
||||
: frame(0) {}
|
||||
|
||||
BOOST_PP_REPEAT(PHOENIX_DYNAMIC_LIMIT, PHOENIX_DYNAMIC_MEMBER, _)
|
||||
|
||||
private:
|
||||
|
||||
template <int N, typename DynamicScope>
|
||||
friend struct dynamic_member;
|
||||
|
||||
template <typename DynamicScope>
|
||||
friend struct dynamic_frame;
|
||||
|
||||
mutable dynamic_frame_type* frame;
|
||||
};
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4355)
|
||||
#endif
|
||||
|
||||
/*
|
||||
PHOENIX_DYNAMIC macro(name, type-name sequence)
|
||||
Example:
|
||||
|
||||
PHOENIX_DYNAMIC(
|
||||
my_dynamic,
|
||||
(int, num)
|
||||
(std::string, message)
|
||||
(double, real)
|
||||
);
|
||||
|
||||
which expands to:
|
||||
|
||||
struct my_dynamic : ::boost::phoenix::dynamic<int, std::string, double>
|
||||
{
|
||||
my_dynamic() : num(*this), message(*this), real(*this) {}
|
||||
|
||||
member1 num;
|
||||
member2 message;
|
||||
member3 real;
|
||||
};
|
||||
|
||||
PHOENIX_DYNAMIC takes the input (containing a binary sequence)
|
||||
and converts that sequence to a unary sequence of
|
||||
binary tuples and passes it on to PHOENIX_DYNAMIC_I.
|
||||
|
||||
Thanks to Paul Mensonides for the PP macro help
|
||||
*/
|
||||
|
||||
#define PHOENIX_DYNAMIC(name, bseq) \
|
||||
PHOENIX_DYNAMIC_I(name, BOOST_PP_CAT(PHOENIX_DYNAMIC_X bseq, 0)) \
|
||||
|
||||
#define PHOENIX_DYNAMIC_X(x, y) ((x, y)) PHOENIX_DYNAMIC_Y
|
||||
#define PHOENIX_DYNAMIC_Y(x, y) ((x, y)) PHOENIX_DYNAMIC_X
|
||||
#define PHOENIX_DYNAMIC_X0
|
||||
#define PHOENIX_DYNAMIC_Y0
|
||||
|
||||
// PHOENIX_DYNAMIC_I generates the overarching structure and uses
|
||||
// SEQ_FOR_EACH_I to generate the "linear" substructures.
|
||||
|
||||
#define PHOENIX_DYNAMIC_I(name, seq) \
|
||||
struct name : \
|
||||
::boost::phoenix::dynamic< \
|
||||
BOOST_PP_SEQ_FOR_EACH_I(PHOENIX_DYNAMIC_A, ~, seq)> { \
|
||||
name() : BOOST_PP_SEQ_FOR_EACH_I(PHOENIX_DYNAMIC_B, ~, seq) {} \
|
||||
BOOST_PP_SEQ_FOR_EACH_I(PHOENIX_DYNAMIC_C, ~, seq) \
|
||||
} \
|
||||
|
||||
#define PHOENIX_DYNAMIC_A(r, _, i, xy) \
|
||||
BOOST_PP_COMMA_IF(i) BOOST_PP_TUPLE_ELEM(2, 0, xy) \
|
||||
|
||||
#define PHOENIX_DYNAMIC_B(r, _, i, xy) \
|
||||
BOOST_PP_COMMA_IF(i) BOOST_PP_TUPLE_ELEM(2, 1, xy)(*this) \
|
||||
|
||||
#define PHOENIX_DYNAMIC_C(r, _, i, xy) \
|
||||
BOOST_PP_CAT(member, BOOST_PP_INC(i)) BOOST_PP_TUPLE_ELEM(2, 1, xy); \
|
||||
|
||||
#undef PHOENIX_DYNAMIC_MEMBER
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,176 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
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 PHOENIX_SCOPE_LAMBDA_HPP
|
||||
#define PHOENIX_SCOPE_LAMBDA_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/scoped_environment.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/detail/local_variable.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/local_reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/fusion/include/transform.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Base, typename OuterEnv, typename Locals, typename Map>
|
||||
struct lambda_eval : Base
|
||||
{
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename Base::template
|
||||
result<scoped_environment<Env, OuterEnv, Locals, Map> >::type
|
||||
result_type;
|
||||
|
||||
typedef typename
|
||||
detail::unwrap_local_reference<result_type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
lambda_eval(
|
||||
Base const& base
|
||||
, OuterEnv const& outer_env
|
||||
, Locals const& locals)
|
||||
: Base(base)
|
||||
, outer_env(outer_env)
|
||||
, locals(locals) {}
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
typedef typename result<Env>::type RT;
|
||||
return RT(Base::eval(
|
||||
scoped_environment<Env, OuterEnv, Locals, Map>(
|
||||
env, outer_env, locals)));
|
||||
}
|
||||
|
||||
OuterEnv outer_env;
|
||||
mutable Locals locals;
|
||||
};
|
||||
|
||||
template <typename Base, typename Vars, typename Map>
|
||||
struct lambda_actor
|
||||
{
|
||||
typedef typename
|
||||
mpl::fold<
|
||||
Vars
|
||||
, mpl::false_
|
||||
, detail::compute_no_nullary
|
||||
>::type
|
||||
no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
fusion::result_of::as_vector<
|
||||
typename fusion::result_of::transform<
|
||||
Vars
|
||||
, detail::initialize_local<Env>
|
||||
>::type
|
||||
>::type
|
||||
locals_type;
|
||||
|
||||
typedef actor<lambda_eval<Base, Env, locals_type, Map> > type;
|
||||
};
|
||||
|
||||
lambda_actor(Base const& f, Vars const& vars)
|
||||
: f(f), vars(vars) {}
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
typedef typename result<Env>::type result_type;
|
||||
|
||||
return result_type(
|
||||
f, env, fusion::as_vector(
|
||||
fusion::transform(
|
||||
vars
|
||||
, detail::initialize_local<Env>(env)
|
||||
)));
|
||||
}
|
||||
|
||||
Base f;
|
||||
Vars vars;
|
||||
};
|
||||
|
||||
template <typename Vars, typename Map>
|
||||
struct lambda_actor_gen
|
||||
{
|
||||
template <typename Base>
|
||||
actor<lambda_actor<Base, Vars, Map> > const
|
||||
operator[](actor<Base> const& f) const
|
||||
{
|
||||
return lambda_actor<Base, Vars, Map>(f, vars);
|
||||
}
|
||||
|
||||
lambda_actor_gen(Vars const& vars)
|
||||
: vars(vars) {}
|
||||
|
||||
Vars vars;
|
||||
};
|
||||
|
||||
template <typename Key>
|
||||
struct local_variable; // forward
|
||||
struct assign_eval; // forward
|
||||
|
||||
struct lambda_gen
|
||||
: lambda_actor_gen<
|
||||
fusion::vector<>
|
||||
, detail::map_local_index_to_tuple<> >
|
||||
{
|
||||
typedef
|
||||
lambda_actor_gen<
|
||||
fusion::vector<>
|
||||
, detail::map_local_index_to_tuple<> >
|
||||
base_type;
|
||||
|
||||
lambda_gen()
|
||||
: base_type(fusion::vector<>())
|
||||
{
|
||||
}
|
||||
|
||||
template <typename K0, typename V0>
|
||||
lambda_actor_gen<
|
||||
fusion::vector<V0>
|
||||
, detail::map_local_index_to_tuple<K0>
|
||||
>
|
||||
operator()(
|
||||
actor<composite<assign_eval, fusion::vector<local_variable<K0>, V0> > > const& a0
|
||||
) const
|
||||
{
|
||||
return fusion::vector<V0>(fusion::at_c<1>(a0));
|
||||
}
|
||||
|
||||
template <typename K0, typename K1, typename V0, typename V1>
|
||||
lambda_actor_gen<
|
||||
fusion::vector<V0, V1>
|
||||
, detail::map_local_index_to_tuple<K0, K1>
|
||||
>
|
||||
operator()(
|
||||
actor<composite<assign_eval, fusion::vector<local_variable<K0>, V0> > > const& a0
|
||||
, actor<composite<assign_eval, fusion::vector<local_variable<K1>, V1> > > const& a1
|
||||
) const
|
||||
{
|
||||
return fusion::vector<V0, V1>(fusion::at_c<1>(a0), fusion::at_c<1>(a1));
|
||||
}
|
||||
|
||||
// Bring in the rest...
|
||||
#define PHOENIX_LOCAL_GEN_NAME lambda_actor_gen
|
||||
#include <boost/spirit/home/phoenix/scope/detail/local_gen.hpp>
|
||||
#undef PHOENIX_LOCAL_GEN_NAME
|
||||
};
|
||||
|
||||
lambda_gen const lambda = lambda_gen();
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,145 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
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 PHOENIX_SCOPE_LET_HPP
|
||||
#define PHOENIX_SCOPE_LET_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/scoped_environment.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/detail/local_variable.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/local_reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/fusion/include/transform.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Base, typename Vars, typename Map>
|
||||
struct let_actor : Base
|
||||
{
|
||||
typedef typename
|
||||
mpl::fold<
|
||||
Vars
|
||||
, mpl::false_
|
||||
, detail::compute_no_nullary
|
||||
>::type
|
||||
no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
fusion::result_of::as_vector<
|
||||
typename fusion::result_of::transform<
|
||||
Vars
|
||||
, detail::initialize_local<Env>
|
||||
>::type
|
||||
>::type
|
||||
locals_type;
|
||||
|
||||
typedef typename Base::template
|
||||
result<scoped_environment<Env, Env, locals_type, Map> >::type
|
||||
result_type;
|
||||
|
||||
typedef typename
|
||||
detail::unwrap_local_reference<result_type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
let_actor(Base const& base, Vars const& vars)
|
||||
: Base(base), vars(vars) {}
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
typedef typename
|
||||
fusion::result_of::as_vector<
|
||||
typename fusion::result_of::transform<
|
||||
Vars
|
||||
, detail::initialize_local<Env>
|
||||
>::type
|
||||
>::type
|
||||
locals_type;
|
||||
|
||||
locals_type locals =
|
||||
fusion::as_vector(
|
||||
fusion::transform(
|
||||
vars
|
||||
, detail::initialize_local<Env>(env)));
|
||||
|
||||
typedef typename result<Env>::type RT;
|
||||
return RT(Base::eval(
|
||||
scoped_environment<Env, Env, locals_type, Map>(
|
||||
env
|
||||
, env
|
||||
, locals)));
|
||||
}
|
||||
|
||||
Vars vars;
|
||||
};
|
||||
|
||||
template <typename Vars, typename Map>
|
||||
struct let_actor_gen
|
||||
{
|
||||
template <typename Base>
|
||||
actor<let_actor<Base, Vars, Map> > const
|
||||
operator[](actor<Base> const& base) const
|
||||
{
|
||||
return let_actor<Base, Vars, Map>(base, vars);
|
||||
}
|
||||
|
||||
let_actor_gen(Vars const& vars)
|
||||
: vars(vars) {}
|
||||
|
||||
Vars vars;
|
||||
};
|
||||
|
||||
template <typename Key>
|
||||
struct local_variable; // forward
|
||||
struct assign_eval; // forward
|
||||
|
||||
struct let_gen
|
||||
{
|
||||
template <typename K0, typename V0>
|
||||
let_actor_gen<
|
||||
fusion::vector<V0>
|
||||
, detail::map_local_index_to_tuple<K0>
|
||||
>
|
||||
operator()(
|
||||
actor<composite<assign_eval, fusion::vector<local_variable<K0>, V0> > > const& a0
|
||||
) const
|
||||
{
|
||||
return fusion::vector<V0>(fusion::at_c<1>(a0));
|
||||
}
|
||||
|
||||
template <typename K0, typename K1, typename V0, typename V1>
|
||||
let_actor_gen<
|
||||
fusion::vector<V0, V1>
|
||||
, detail::map_local_index_to_tuple<K0, K1>
|
||||
>
|
||||
operator()(
|
||||
actor<composite<assign_eval, fusion::vector<local_variable<K0>, V0> > > const& a0
|
||||
, actor<composite<assign_eval, fusion::vector<local_variable<K1>, V1> > > const& a1
|
||||
) const
|
||||
{
|
||||
return fusion::vector<V0, V1>(fusion::at_c<1>(a0), fusion::at_c<1>(a1));
|
||||
}
|
||||
|
||||
// Bring in the rest...
|
||||
#define PHOENIX_LOCAL_GEN_NAME let_actor_gen
|
||||
#include <boost/spirit/home/phoenix/scope/detail/local_gen.hpp>
|
||||
#undef PHOENIX_LOCAL_GEN_NAME
|
||||
};
|
||||
|
||||
let_gen const let = let_gen();
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,111 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
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 PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
|
||||
#define PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/spirit/home/phoenix/detail/local_reference.hpp>
|
||||
#include <boost/spirit/home/phoenix/scope/detail/local_variable.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Key>
|
||||
struct local_variable
|
||||
{
|
||||
typedef Key key_type;
|
||||
|
||||
// This will prevent actor::operator()() from kicking in.
|
||||
// Actually, we do not need all actor::operator()s for
|
||||
// all arities, but this will suffice. The nullary
|
||||
// actor::operator() is particularly troublesome because
|
||||
// it is always eagerly evaluated by the compiler.
|
||||
typedef mpl::true_ no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result : detail::apply_local<local_variable<Key>, Env> {};
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
typedef typename result<Env>::type return_type;
|
||||
typedef typename
|
||||
detail::get_index<typename Env::map_type, Key>::type
|
||||
index_type;
|
||||
typedef detail::eval_local<Key> eval_local;
|
||||
|
||||
return eval_local::template get<return_type>(
|
||||
env
|
||||
, index_type());
|
||||
}
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
local_variable& operator= (local_variable const&);
|
||||
};
|
||||
|
||||
namespace local_names
|
||||
{
|
||||
actor<local_variable<struct _a_key> > const _a
|
||||
= local_variable<struct _a_key>();
|
||||
actor<local_variable<struct _b_key> > const _b
|
||||
= local_variable<struct _b_key>();
|
||||
actor<local_variable<struct _c_key> > const _c
|
||||
= local_variable<struct _c_key>();
|
||||
actor<local_variable<struct _d_key> > const _d
|
||||
= local_variable<struct _d_key>();
|
||||
actor<local_variable<struct _e_key> > const _e
|
||||
= local_variable<struct _e_key>();
|
||||
actor<local_variable<struct _f_key> > const _f
|
||||
= local_variable<struct _f_key>();
|
||||
actor<local_variable<struct _g_key> > const _g
|
||||
= local_variable<struct _g_key>();
|
||||
actor<local_variable<struct _h_key> > const _h
|
||||
= local_variable<struct _h_key>();
|
||||
actor<local_variable<struct _i_key> > const _i
|
||||
= local_variable<struct _i_key>();
|
||||
actor<local_variable<struct _j_key> > const _j
|
||||
= local_variable<struct _j_key>();
|
||||
actor<local_variable<struct _k_key> > const _k
|
||||
= local_variable<struct _k_key>();
|
||||
actor<local_variable<struct _l_key> > const _l
|
||||
= local_variable<struct _l_key>();
|
||||
actor<local_variable<struct _m_key> > const _m
|
||||
= local_variable<struct _m_key>();
|
||||
actor<local_variable<struct _n_key> > const _n
|
||||
= local_variable<struct _n_key>();
|
||||
actor<local_variable<struct _o_key> > const _o
|
||||
= local_variable<struct _o_key>();
|
||||
actor<local_variable<struct _p_key> > const _p
|
||||
= local_variable<struct _p_key>();
|
||||
actor<local_variable<struct _q_key> > const _q
|
||||
= local_variable<struct _q_key>();
|
||||
actor<local_variable<struct _r_key> > const _r
|
||||
= local_variable<struct _r_key>();
|
||||
actor<local_variable<struct _s_key> > const _s
|
||||
= local_variable<struct _s_key>();
|
||||
actor<local_variable<struct _t_key> > const _t
|
||||
= local_variable<struct _t_key>();
|
||||
actor<local_variable<struct _u_key> > const _u
|
||||
= local_variable<struct _u_key>();
|
||||
actor<local_variable<struct _v_key> > const _v
|
||||
= local_variable<struct _v_key>();
|
||||
actor<local_variable<struct _w_key> > const _w
|
||||
= local_variable<struct _w_key>();
|
||||
actor<local_variable<struct _x_key> > const _x
|
||||
= local_variable<struct _x_key>();
|
||||
actor<local_variable<struct _y_key> > const _y
|
||||
= local_variable<struct _y_key>();
|
||||
actor<local_variable<struct _z_key> > const _z
|
||||
= local_variable<struct _z_key>();
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
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 PHOENIX_SCOPE_SCOPED_ENVIRONMENT_HPP
|
||||
#define PHOENIX_SCOPE_SCOPED_ENVIRONMENT_HPP
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Env, typename OuterEnv, typename Locals, typename Map>
|
||||
struct scoped_environment
|
||||
{
|
||||
typedef Env env_type;
|
||||
typedef OuterEnv outer_env_type;
|
||||
typedef Locals locals_type;
|
||||
typedef Map map_type;
|
||||
typedef typename Env::args_type args_type;
|
||||
typedef typename Env::tie_type tie_type;
|
||||
|
||||
scoped_environment(
|
||||
Env const& env
|
||||
, OuterEnv const& outer_env
|
||||
, Locals& locals)
|
||||
: env(env)
|
||||
, outer_env(outer_env)
|
||||
, locals(locals) {}
|
||||
|
||||
tie_type const&
|
||||
args() const
|
||||
{
|
||||
return env.args();
|
||||
}
|
||||
|
||||
Env const& env;
|
||||
OuterEnv const& outer_env;
|
||||
Locals& locals;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
scoped_environment& operator= (scoped_environment const&);
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,20 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_HPP
|
||||
#define PHOENIX_STATEMENT_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/version.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/do_while.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/for.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/if.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/sequence.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/switch.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/while.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/throw.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/try_catch.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_STATEMENT_DETAIL_CATCH_ALL_EVAL_HPP
|
||||
#define PHOENIX_STATEMENT_DETAIL_CATCH_ALL_EVAL_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_defaults.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
class catch_all_eval
|
||||
{
|
||||
public:
|
||||
template<typename Env, typename TryBody,
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(PHOENIX_CATCH_LIMIT, typename CatchBody, mpl::void_),
|
||||
typename CatchAllBody = mpl::void_>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template<typename Rt, typename Env, typename TryBody,
|
||||
typename CatchAllBody>
|
||||
static void eval(
|
||||
const Env& env, TryBody& tryBody, CatchAllBody& catchAllBody)
|
||||
{
|
||||
try
|
||||
{
|
||||
tryBody.eval(env);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
catchAllBody.eval(env);
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, PHOENIX_CATCH_LIMIT, "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
template<typename Rt, typename Env, typename TryBody,
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename CatchBody),
|
||||
typename CatchAllBody>
|
||||
static void eval(
|
||||
const Env& env, TryBody& tryBody,
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, CatchBody, catchBody),
|
||||
CatchAllBody& catchAllBody)
|
||||
{
|
||||
try
|
||||
{
|
||||
tryBody.eval(env);
|
||||
}
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_2 \
|
||||
(3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
catch(...)
|
||||
{
|
||||
catchAllBody.eval(env);
|
||||
}
|
||||
}
|
||||
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 2
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
catch(typename BOOST_PP_CAT(CatchBody, PHOENIX_ITERATION)::exception_type&)
|
||||
{
|
||||
BOOST_PP_CAT(catchBody, PHOENIX_ITERATION).eval(env);
|
||||
}
|
||||
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_DETAIL_CATCH_COMPOSITE_HPP
|
||||
#define PHOENIX_STATEMENT_DETAIL_CATCH_COMPOSITE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
namespace detail
|
||||
{
|
||||
struct catch_composite_eval
|
||||
{
|
||||
template<typename Env, typename Actor>
|
||||
struct result :
|
||||
eval_result<typename Actor::eval_type, Env> {};
|
||||
|
||||
template<typename Rt, typename Env, typename Actor>
|
||||
static typename result<Env,Actor>::type
|
||||
eval(const Env& env, Actor& actor)
|
||||
{
|
||||
return actor.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Exception, typename Actor>
|
||||
struct catch_composite :
|
||||
composite<catch_composite_eval, fusion::vector<Actor> >
|
||||
{
|
||||
catch_composite(const Actor& actor)
|
||||
: composite<catch_composite_eval, fusion::vector<Actor> >(actor) { }
|
||||
|
||||
typedef Exception exception_type;
|
||||
};
|
||||
|
||||
template<typename Exception, typename Actor>
|
||||
struct as_catch_actor
|
||||
{
|
||||
typedef catch_composite<
|
||||
Exception,
|
||||
Actor> comp;
|
||||
|
||||
typedef actor<comp> type;
|
||||
};
|
||||
|
||||
template<typename Exception, typename Actor>
|
||||
inline typename as_catch_actor<Exception, Actor>::type
|
||||
catch_actor(const Actor& actor)
|
||||
{
|
||||
return catch_composite<Exception,Actor>(actor);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_STATEMENT_DETAIL_CATCH_EVAL_HPP
|
||||
#define PHOENIX_STATEMENT_DETAIL_CATCH_EVAL_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/limits.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_defaults.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
class catch_eval
|
||||
{
|
||||
public:
|
||||
template<typename Env, typename TryBody,
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(PHOENIX_CATCH_LIMIT, typename CatchBody, mpl::void_)>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, PHOENIX_CATCH_LIMIT, "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
template<typename Rt, typename Env, typename TryBody,
|
||||
BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename CatchBody)>
|
||||
static void eval(
|
||||
const Env& env, TryBody& tryBody,
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, CatchBody, catchBody))
|
||||
{
|
||||
try
|
||||
{
|
||||
tryBody.eval(env);
|
||||
}
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_2 \
|
||||
(3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp"))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}
|
||||
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 2
|
||||
|
||||
#define PHOENIX_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
catch(typename BOOST_PP_CAT(CatchBody, PHOENIX_ITERATION)::exception_type&)
|
||||
{
|
||||
BOOST_PP_CAT(catchBody, PHOENIX_ITERATION).eval(env);
|
||||
}
|
||||
|
||||
#undef PHOENIX_ITERATION
|
||||
|
||||
#endif
|
||||
@@ -1,172 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
||||
#define PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/nothing.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
#include <boost/fusion/include/push_back.hpp>
|
||||
#include <boost/fusion/include/push_front.hpp>
|
||||
#include <boost/fusion/include/begin.hpp>
|
||||
#include <boost/fusion/include/size.hpp>
|
||||
#include <boost/fusion/include/value_of.hpp>
|
||||
#include <boost/fusion/include/is_sequence.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
|
||||
template <typename Actor, typename K, K Value>
|
||||
struct switch_case;
|
||||
|
||||
template <typename Actor>
|
||||
struct default_case;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct is_default_case : mpl::bool_<T::is_default> {};
|
||||
|
||||
template <typename A0, typename A1>
|
||||
struct compose_case_a
|
||||
{
|
||||
// here, A0 and A1 are both switch cases
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_default_case<A1>
|
||||
, fusion::vector<actor<A1>, actor<A0> >
|
||||
, fusion::vector<actor<A0>, actor<A1> >
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
eval(A0 const& _0, A1 const& _1, mpl::false_)
|
||||
{
|
||||
return type(_0, _1);
|
||||
}
|
||||
|
||||
static type
|
||||
eval(A0 const& _0, A1 const& _1, mpl::true_)
|
||||
{
|
||||
return type(_1, _0);
|
||||
}
|
||||
|
||||
static type
|
||||
eval(A0 const& _0, A1 const& _1)
|
||||
{
|
||||
return eval(_0, _1, is_default_case<A1>());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Seq, typename Case>
|
||||
struct compose_case_b
|
||||
{
|
||||
typedef typename fusion::result_of::as_vector<
|
||||
typename mpl::eval_if<
|
||||
is_default_case<Case>
|
||||
, fusion::result_of::push_front<Seq const, actor<Case> >
|
||||
, fusion::result_of::push_back<Seq const, actor<Case> >
|
||||
>::type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
eval(Seq const& seq, Case const& case_, mpl::false_)
|
||||
{
|
||||
return fusion::as_vector(
|
||||
fusion::push_back(seq, actor<Case>(case_)));
|
||||
}
|
||||
|
||||
static type
|
||||
eval(Seq const& seq, Case const& case_, mpl::true_)
|
||||
{
|
||||
return fusion::as_vector(
|
||||
fusion::push_front(seq, actor<Case>(case_)));
|
||||
}
|
||||
|
||||
static type
|
||||
eval(Seq const& seq, Case const& case_)
|
||||
{
|
||||
return eval(seq, case_, is_default_case<Case>());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cases>
|
||||
struct ensure_default
|
||||
{
|
||||
typedef
|
||||
is_default_case<
|
||||
typename fusion::result_of::value_of<
|
||||
typename fusion::result_of::begin<Cases>::type
|
||||
>::type
|
||||
>
|
||||
is_default_case_;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_default_case_
|
||||
, mpl::identity<Cases>
|
||||
, fusion::result_of::push_front<
|
||||
Cases const, actor<default_case<actor<null_actor> > > >
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
eval(Cases const& cases, mpl::false_);
|
||||
|
||||
static type
|
||||
eval(Cases const& cases, mpl::true_)
|
||||
{
|
||||
return cases;
|
||||
}
|
||||
|
||||
static type
|
||||
eval(Cases const& cases)
|
||||
{
|
||||
return eval(cases, is_default_case_());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cond, typename Cases>
|
||||
struct switch_composite
|
||||
{
|
||||
BOOST_STATIC_ASSERT(fusion::traits::is_sequence<Cases>::value);
|
||||
typedef ensure_default<Cases> ensure_default_;
|
||||
|
||||
typedef typename
|
||||
fusion::result_of::as_vector<
|
||||
typename fusion::result_of::push_front<
|
||||
typename ensure_default_::type, Cond>::type
|
||||
>::type
|
||||
tuple_type;
|
||||
|
||||
typedef
|
||||
composite<
|
||||
detail::switch_eval<fusion::result_of::size<tuple_type>::value-2>
|
||||
, tuple_type>
|
||||
type;
|
||||
|
||||
static type
|
||||
eval(Cond const& cond, Cases const& cases)
|
||||
{
|
||||
return fusion::as_vector(
|
||||
fusion::push_front(ensure_default_::eval(cases), cond));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cond, typename Cases>
|
||||
struct switch_composite_actor
|
||||
{
|
||||
typedef actor<typename switch_composite<Cond, Cases>::type> type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,111 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_DETAIL_SWITCH_EVAL_HPP
|
||||
#define PHOENIX_STATEMENT_DETAIL_SWITCH_EVAL_HPP
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct switch_eval;
|
||||
|
||||
template <>
|
||||
struct switch_eval<0>
|
||||
{
|
||||
template <
|
||||
typename Env, typename Cond, typename Default
|
||||
>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT, typename Env, typename Cond, typename Default
|
||||
>
|
||||
static void
|
||||
eval(
|
||||
Env const& env, Cond& cond, Default& default_
|
||||
)
|
||||
{
|
||||
default_.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct switch_eval<1>
|
||||
{
|
||||
template <
|
||||
typename Env, typename Cond, typename Default
|
||||
, typename Case0
|
||||
>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT, typename Env, typename Cond, typename Default
|
||||
, typename Case0
|
||||
>
|
||||
static void
|
||||
eval(
|
||||
Env const& env, Cond& cond, Default& default_
|
||||
, Case0& _0
|
||||
)
|
||||
{
|
||||
switch (cond.eval(env))
|
||||
{
|
||||
case Case0::value:
|
||||
_0.eval(env);
|
||||
break;
|
||||
default:
|
||||
default_.eval(env);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct switch_eval<2>
|
||||
{
|
||||
template <
|
||||
typename Env, typename Cond, typename Default
|
||||
, typename Case0, typename Case1
|
||||
>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT, typename Env, typename Cond, typename Default
|
||||
, typename Case0, typename Case1
|
||||
>
|
||||
static void
|
||||
eval(
|
||||
Env const& env, Cond& cond, Default& default_
|
||||
, Case0& _0, Case1& _1
|
||||
)
|
||||
{
|
||||
switch (cond.eval(env))
|
||||
{
|
||||
case Case0::value:
|
||||
_0.eval(env);
|
||||
break;
|
||||
case Case1::value:
|
||||
_1.eval(env);
|
||||
break;
|
||||
default:
|
||||
default_.eval(env);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Bring in the rest of the switch_evals
|
||||
#include <boost/spirit/home/phoenix/statement/detail/switch_eval.ipp>
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#ifndef PHOENIX_STATEMENT_DETAIL_SWITCH_EVAL_IPP
|
||||
#define PHOENIX_STATEMENT_DETAIL_SWITCH_EVAL_IPP
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define PHOENIX_CASE_ITEM(z, n, prefix) \
|
||||
case BOOST_PP_CAT(Case, n)::value: \
|
||||
BOOST_PP_CAT(_, n).eval(env); \
|
||||
break;
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT)), \
|
||||
"boost/spirit/home/phoenix/statement/detail/switch_eval.ipp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef PHOENIX_CASE_ITEM
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct switch_eval<N>
|
||||
{
|
||||
template <
|
||||
typename Env, typename Cond, typename Default
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename Case)
|
||||
>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT, typename Env, typename Cond, typename Default
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename Case)
|
||||
>
|
||||
static void
|
||||
eval(Env const& env, Cond& cond, Default& default_
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, Case, & _)
|
||||
)
|
||||
{
|
||||
switch (cond.eval(env))
|
||||
{
|
||||
BOOST_PP_REPEAT(N, PHOENIX_CASE_ITEM, _)
|
||||
default:
|
||||
default_.eval(env);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_DO_WHILE_HPP
|
||||
#define PHOENIX_STATEMENT_DO_WHILE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct do_while_eval
|
||||
{
|
||||
template <typename Env, typename Cond, typename Do>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename Cond, typename Do>
|
||||
static void
|
||||
eval(Env const& env, Cond& cond, Do& do_)
|
||||
{
|
||||
do
|
||||
do_.eval(env);
|
||||
while (cond.eval(env));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Do>
|
||||
struct do_while_gen
|
||||
{
|
||||
do_while_gen(Do const& do_)
|
||||
: do_(do_) {}
|
||||
|
||||
template <typename Cond>
|
||||
actor<typename as_composite<do_while_eval, Cond, Do>::type>
|
||||
while_(Cond const& cond) const
|
||||
{
|
||||
return compose<do_while_eval>(cond, do_);
|
||||
}
|
||||
|
||||
Do do_;
|
||||
};
|
||||
|
||||
struct do_gen
|
||||
{
|
||||
template <typename Do>
|
||||
do_while_gen<Do>
|
||||
operator[](Do const& do_) const
|
||||
{
|
||||
return do_while_gen<Do>(do_);
|
||||
}
|
||||
};
|
||||
|
||||
do_gen const do_ = do_gen();
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_FOR_HPP
|
||||
#define PHOENIX_STATEMENT_FOR_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct for_eval
|
||||
{
|
||||
template <
|
||||
typename Env
|
||||
, typename Init, typename Cond, typename Step, typename Do>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT, typename Env
|
||||
, typename Init, typename Cond, typename Step, typename Do>
|
||||
static void
|
||||
eval(
|
||||
Env const& env
|
||||
, Init& init, Cond& cond, Step& step, Do& do_)
|
||||
{
|
||||
for (init.eval(env); cond.eval(env); step.eval(env))
|
||||
do_.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Init, typename Cond, typename Step>
|
||||
struct for_gen
|
||||
{
|
||||
for_gen(Init const& init, Cond const& cond, Step const& step)
|
||||
: init(init), cond(cond), step(step) {}
|
||||
|
||||
template <typename Do>
|
||||
actor<typename as_composite<for_eval, Init, Cond, Step, Do>::type>
|
||||
operator[](Do const& do_) const
|
||||
{
|
||||
return compose<for_eval>(init, cond, step, do_);
|
||||
}
|
||||
|
||||
Init init;
|
||||
Cond cond;
|
||||
Step step;
|
||||
};
|
||||
|
||||
template <typename Init, typename Cond, typename Step>
|
||||
inline for_gen<Init, Cond, Step>
|
||||
for_(Init const& init, Cond const& cond, Step const& step)
|
||||
{
|
||||
return for_gen<Init, Cond, Step>(init, cond, step);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,130 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_IF_HPP
|
||||
#define PHOENIX_STATEMENT_IF_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/as_actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4355)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct if_else_eval
|
||||
{
|
||||
template <typename Env, typename Cond, typename Then, typename Else>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
typename RT, typename Env
|
||||
, typename Cond, typename Then, typename Else>
|
||||
static void
|
||||
eval(Env const& env, Cond& cond, Then& then, Else& else_)
|
||||
{
|
||||
if (cond.eval(env))
|
||||
then.eval(env);
|
||||
else
|
||||
else_.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
struct if_eval
|
||||
{
|
||||
template <typename Env, typename Cond, typename Then>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename Cond, typename Then>
|
||||
static void
|
||||
eval(Env const& env, Cond& cond, Then& then)
|
||||
{
|
||||
if (cond.eval(env))
|
||||
then.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cond, typename Then>
|
||||
struct if_composite;
|
||||
|
||||
template <typename Cond, typename Then>
|
||||
struct else_gen
|
||||
{
|
||||
else_gen(if_composite<Cond, Then> const& source)
|
||||
: source(source) {}
|
||||
|
||||
template <typename Else>
|
||||
actor<typename as_composite<if_else_eval, Cond, Then, Else>::type>
|
||||
operator[](Else const& else_) const
|
||||
{
|
||||
return compose<if_else_eval>(
|
||||
fusion::at_c<0>(source) // cond
|
||||
, fusion::at_c<1>(source) // then
|
||||
, else_ // else
|
||||
);
|
||||
}
|
||||
|
||||
if_composite<Cond, Then> const& source;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
else_gen& operator= (else_gen const&);
|
||||
};
|
||||
|
||||
template <typename Cond, typename Then>
|
||||
struct if_composite : composite<if_eval, fusion::vector<Cond, Then> >
|
||||
{
|
||||
if_composite(Cond const& cond, Then const& then)
|
||||
: composite<if_eval, fusion::vector<Cond, Then> >(cond, then)
|
||||
, else_(*this) {}
|
||||
|
||||
else_gen<Cond, Then> else_;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
if_composite& operator= (if_composite const&);
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
struct if_gen
|
||||
{
|
||||
if_gen(Cond const& cond)
|
||||
: cond(cond) {}
|
||||
|
||||
template <typename Then>
|
||||
actor<if_composite<Cond, typename as_actor<Then>::type> >
|
||||
operator[](Then const& then) const
|
||||
{
|
||||
return actor<if_composite<Cond, typename as_actor<Then>::type> >(
|
||||
cond, as_actor<Then>::convert(then));
|
||||
}
|
||||
|
||||
Cond cond;
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
inline if_gen<typename as_actor<Cond>::type>
|
||||
if_(Cond const& cond)
|
||||
{
|
||||
return if_gen<typename as_actor<Cond>::type>(
|
||||
as_actor<Cond>::convert(cond));
|
||||
}
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_SEQUENCE_HPP
|
||||
#define PHOENIX_STATEMENT_SEQUENCE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct sequence_eval
|
||||
{
|
||||
template <typename Env, typename A0, typename A1>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename A0, typename A1>
|
||||
static void
|
||||
eval(Env const& env, A0& a0, A1& a1)
|
||||
{
|
||||
a0.eval(env);
|
||||
a1.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename BaseT0, typename BaseT1>
|
||||
struct comma_result
|
||||
{
|
||||
typedef actor<
|
||||
typename as_composite<
|
||||
sequence_eval
|
||||
, actor<BaseT0>
|
||||
, actor<BaseT1>
|
||||
>::type
|
||||
> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename BaseT0, typename BaseT1>
|
||||
inline typename detail::comma_result<BaseT0, BaseT1>::type
|
||||
operator,(actor<BaseT0> const& a0, actor<BaseT1> const& a1)
|
||||
{
|
||||
return compose<sequence_eval>(a0, a1);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,164 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_SWITCH_HPP
|
||||
#define PHOENIX_STATEMENT_SWITCH_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/nothing.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/detail/switch_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/detail/switch.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Derived, typename Actor>
|
||||
struct switch_case_base
|
||||
{
|
||||
typedef Derived derived_t;
|
||||
typedef Actor actor_t;
|
||||
typedef typename Actor::no_nullary no_nullary;
|
||||
|
||||
template <typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef typename Actor::eval_type::template result<Env>::type type;
|
||||
};
|
||||
|
||||
switch_case_base(Actor const& actor)
|
||||
: actor(actor) {}
|
||||
|
||||
template <typename Env>
|
||||
typename result<Env>::type
|
||||
eval(Env const& env) const
|
||||
{
|
||||
return actor.eval(env);
|
||||
}
|
||||
|
||||
Actor actor;
|
||||
};
|
||||
|
||||
template <typename Actor, typename K, K Value>
|
||||
struct switch_case : switch_case_base<switch_case<Actor, K, Value>, Actor>
|
||||
{
|
||||
typedef switch_case_base<switch_case<Actor, K, Value>, Actor> base_t;
|
||||
static K const value = Value;
|
||||
static bool const is_default = false;
|
||||
|
||||
switch_case(Actor const& actor)
|
||||
: base_t(actor) {}
|
||||
};
|
||||
|
||||
template <typename Actor>
|
||||
struct default_case : switch_case_base<default_case<Actor>, Actor>
|
||||
{
|
||||
typedef switch_case_base<default_case<Actor>, Actor> base_t;
|
||||
static bool const is_default = true;
|
||||
|
||||
default_case(Actor const& actor)
|
||||
: base_t(actor) {}
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
struct switch_gen
|
||||
{
|
||||
switch_gen(Cond const& cond)
|
||||
: cond(cond) {}
|
||||
|
||||
template <typename Cases>
|
||||
typename lazy_enable_if<
|
||||
fusion::traits::is_sequence<Cases>
|
||||
, detail::switch_composite_actor<Cond, Cases>
|
||||
>::type
|
||||
operator[](Cases const& cases) const
|
||||
{
|
||||
typedef typename
|
||||
detail::switch_composite<Cond, Cases>
|
||||
switch_composite;
|
||||
return switch_composite::eval(cond, cases);
|
||||
}
|
||||
|
||||
template <typename D, typename A>
|
||||
actor<typename detail::
|
||||
switch_composite<Cond, fusion::vector<actor<D> > >::type>
|
||||
operator[](switch_case_base<D, A> const& case_) const
|
||||
{
|
||||
typedef typename
|
||||
detail::switch_composite<Cond, fusion::vector<actor<D> > >
|
||||
switch_composite;
|
||||
return switch_composite::eval(cond,
|
||||
fusion::vector<actor<D> >(static_cast<D const&>(case_)));
|
||||
}
|
||||
|
||||
Cond cond;
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
inline switch_gen<typename as_actor<Cond>::type>
|
||||
switch_(Cond const& cond)
|
||||
{
|
||||
return switch_gen<typename as_actor<Cond>::type>(
|
||||
as_actor<Cond>::convert(cond));
|
||||
}
|
||||
|
||||
template <int N, typename A0>
|
||||
switch_case<typename as_actor<A0>::type, int, N>
|
||||
case_(A0 const& _0)
|
||||
{
|
||||
return switch_case<typename as_actor<A0>::type, int, N>
|
||||
(as_actor<A0>::convert(_0));
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
default_case<typename as_actor<A0>::type>
|
||||
default_(A0 const& _0)
|
||||
{
|
||||
return default_case<typename as_actor<A0>::type>
|
||||
(as_actor<A0>::convert(_0));
|
||||
}
|
||||
|
||||
template <typename D0, typename A0, typename D1, typename A1>
|
||||
inline typename detail::compose_case_a<D0, D1>::type
|
||||
operator,(
|
||||
switch_case_base<D0, A0> const& _0
|
||||
, switch_case_base<D1, A1> const& _1
|
||||
)
|
||||
{
|
||||
return detail::compose_case_a<D0, D1>::eval(
|
||||
static_cast<D0 const&>(_0)
|
||||
, static_cast<D1 const&>(_1)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Seq, typename D, typename A>
|
||||
inline typename
|
||||
lazy_enable_if<
|
||||
fusion::traits::is_sequence<Seq>
|
||||
, detail::compose_case_b<Seq, D>
|
||||
>::type
|
||||
operator,(Seq const& seq, switch_case_base<D, A> const& case_)
|
||||
{
|
||||
return detail::compose_case_b<Seq, D>::eval(
|
||||
seq, static_cast<D const&>(case_));
|
||||
}
|
||||
|
||||
// Implementation of routines in detail/switch.hpp that depend on
|
||||
// the completeness of default_case.
|
||||
namespace detail {
|
||||
template <typename Cases>
|
||||
typename ensure_default<Cases>::type
|
||||
ensure_default<Cases>::eval(Cases const& cases, mpl::false_)
|
||||
{
|
||||
actor<default_case<actor<null_actor> > > default_
|
||||
= default_case<actor<null_actor> >(nothing);
|
||||
return fusion::push_front(cases, default_);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,66 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_THROW_HPP
|
||||
#define PHOENIX_STATEMENT_THROW_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
|
||||
struct throw_new_eval
|
||||
{
|
||||
template<typename Env, typename ThrowExpr>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template<typename Rt, typename Env, typename ThrowExpr>
|
||||
static void
|
||||
eval(const Env& env, ThrowExpr& throwExpr)
|
||||
{
|
||||
throw throwExpr.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
struct throw_again_eval
|
||||
{
|
||||
typedef mpl::false_ no_nullary;
|
||||
|
||||
template<typename Env>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template<typename Env>
|
||||
void eval(const Env&) const
|
||||
{
|
||||
throw;
|
||||
}
|
||||
};
|
||||
|
||||
inline actor<throw_again_eval> throw_()
|
||||
{
|
||||
return throw_again_eval();
|
||||
}
|
||||
|
||||
template<typename Actor>
|
||||
actor<typename as_composite<throw_new_eval, Actor>::type>
|
||||
throw_(const Actor& a)
|
||||
{
|
||||
return compose<throw_new_eval>(a);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,188 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
Copyright (c) 2005-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_TRY_CATCH_HPP
|
||||
#define PHOENIX_STATEMENT_TRY_CATCH_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/actor.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
|
||||
#include <boost/fusion/include/push_back.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/statement/detail/catch_composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/detail/catch_eval.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4355)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
|
||||
template<typename Tuple> struct try_catch_composite;
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template<typename Composite, typename Actor>
|
||||
struct try_catch_composite_push_back
|
||||
{
|
||||
typedef typename Composite::base_type actor_tuple;
|
||||
typedef try_catch_composite<
|
||||
typename fusion::result_of::as_vector<
|
||||
typename fusion::result_of::push_back<
|
||||
actor_tuple, Actor>::type>::type> type;
|
||||
};
|
||||
|
||||
template<typename Composite, typename Actor>
|
||||
struct catch_all_composite_push_back
|
||||
{
|
||||
typedef typename Composite::base_type actor_tuple;
|
||||
|
||||
typedef composite<
|
||||
catch_all_eval,
|
||||
typename fusion::result_of::as_vector<
|
||||
typename fusion::result_of::push_back<
|
||||
actor_tuple, Actor>::type>::type> type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct try_catch_composite_push_back
|
||||
{
|
||||
template<typename Composite, typename Actor>
|
||||
struct result
|
||||
: meta::try_catch_composite_push_back<Composite, Actor>
|
||||
{};
|
||||
|
||||
template<typename Composite, typename Actor>
|
||||
typename result<Composite, Actor>::type
|
||||
operator()(
|
||||
const Composite& composite, const Actor& actor) const
|
||||
{
|
||||
typedef typename result<Composite, Actor>::type result;
|
||||
return result(
|
||||
fusion::as_vector(
|
||||
fusion::push_back(composite, actor)));
|
||||
}
|
||||
};
|
||||
|
||||
struct catch_all_composite_push_back
|
||||
{
|
||||
template<typename Composite, typename Actor>
|
||||
struct result
|
||||
: meta::catch_all_composite_push_back<Composite, Actor>
|
||||
{};
|
||||
|
||||
template<typename Composite, typename Actor>
|
||||
typename result<Composite, Actor>::type
|
||||
operator()(
|
||||
const Composite& composite, const Actor& actor) const
|
||||
{
|
||||
typedef typename result<Composite, Actor>::type result;
|
||||
return result(
|
||||
fusion::as_vector(
|
||||
fusion::push_back(composite, actor)));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
detail::try_catch_composite_push_back const try_catch_composite_push_back
|
||||
= detail::try_catch_composite_push_back();
|
||||
detail::catch_all_composite_push_back const catch_all_composite_push_back
|
||||
= detail::catch_all_composite_push_back();
|
||||
|
||||
template<typename Exception, typename SourceComposite>
|
||||
struct catch_gen
|
||||
{
|
||||
explicit catch_gen(
|
||||
const SourceComposite& sourceComposite)
|
||||
: mSourceComposite(sourceComposite) { }
|
||||
|
||||
template<typename Actor>
|
||||
actor<typename meta::try_catch_composite_push_back<
|
||||
SourceComposite,
|
||||
detail::catch_composite<Exception, Actor> >::type>
|
||||
operator[](const Actor& actor) const
|
||||
{
|
||||
return try_catch_composite_push_back(
|
||||
mSourceComposite, detail::catch_composite<Exception, Actor>(actor));
|
||||
}
|
||||
|
||||
const SourceComposite& mSourceComposite;
|
||||
};
|
||||
|
||||
template<typename SourceComposite>
|
||||
struct catch_all_gen
|
||||
{
|
||||
explicit catch_all_gen(
|
||||
const SourceComposite& sourceComposite)
|
||||
: mSourceComposite(sourceComposite) { }
|
||||
|
||||
template<typename Actor>
|
||||
actor<typename meta::catch_all_composite_push_back<SourceComposite, Actor>::type>
|
||||
operator[](const Actor& actor) const
|
||||
{
|
||||
return catch_all_composite_push_back(
|
||||
mSourceComposite, actor);
|
||||
}
|
||||
|
||||
const SourceComposite& mSourceComposite;
|
||||
};
|
||||
|
||||
template<typename Tuple>
|
||||
struct try_catch_composite
|
||||
: composite<catch_eval, Tuple>
|
||||
{
|
||||
explicit try_catch_composite(
|
||||
const Tuple& t)
|
||||
:
|
||||
composite<catch_eval, Tuple>(t),
|
||||
catch_all(*this) { }
|
||||
|
||||
try_catch_composite(
|
||||
const try_catch_composite& rhs)
|
||||
: composite<catch_eval, Tuple>(rhs),
|
||||
catch_all(*this) { }
|
||||
|
||||
template<typename Exception>
|
||||
catch_gen<Exception, try_catch_composite> catch_() const
|
||||
{
|
||||
return catch_gen<Exception, try_catch_composite>(
|
||||
*this);
|
||||
}
|
||||
|
||||
const catch_all_gen<try_catch_composite> catch_all;
|
||||
|
||||
private:
|
||||
try_catch_composite& operator=(const try_catch_composite&);
|
||||
};
|
||||
|
||||
struct try_gen
|
||||
{
|
||||
template<typename Try>
|
||||
try_catch_composite<fusion::vector<Try> > operator[](
|
||||
const Try& try_) const
|
||||
{
|
||||
typedef fusion::vector<Try> tuple_type;
|
||||
return try_catch_composite<tuple_type>(
|
||||
tuple_type(try_));
|
||||
}
|
||||
};
|
||||
|
||||
try_gen const try_ = try_gen();
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STATEMENT_WHILE_HPP
|
||||
#define PHOENIX_STATEMENT_WHILE_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/core/composite.hpp>
|
||||
#include <boost/spirit/home/phoenix/core/compose.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct while_eval
|
||||
{
|
||||
template <typename Env, typename Cond, typename Do>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename RT, typename Env, typename Cond, typename Do>
|
||||
static void
|
||||
eval(Env const& env, Cond& cond, Do& do_)
|
||||
{
|
||||
while (cond.eval(env))
|
||||
do_.eval(env);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
struct while_gen
|
||||
{
|
||||
while_gen(Cond const& cond)
|
||||
: cond(cond) {}
|
||||
|
||||
template <typename Do>
|
||||
actor<typename as_composite<while_eval, Cond, Do>::type>
|
||||
operator[](Do const& do_) const
|
||||
{
|
||||
return compose<while_eval>(cond, do_);
|
||||
}
|
||||
|
||||
Cond cond;
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
inline while_gen<Cond>
|
||||
while_(Cond const& cond)
|
||||
{
|
||||
return while_gen<Cond>(cond);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Daniel Wallin
|
||||
Copyright (c) 2005 Dan Marsden
|
||||
Copyright (c) 2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STL_HPP
|
||||
#define PHOENIX_STL_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl/container.hpp>
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2004 Angus Leeming
|
||||
Copyright (c) 2006 Daniel Wallin
|
||||
Copyright (c) 2005 Dan Marsden
|
||||
Copyright (c) 2007 Joel de Guzman
|
||||
|
||||
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 PHOENIX_STL_ALGORITHM_HPP
|
||||
#define PHOENIX_STL_ALGORITHM_HPP
|
||||
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm/iteration.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm/querying.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl/algorithm/transformation.hpp>
|
||||
|
||||
#endif // PHOENIX_STL_ALGORITHM_HPP
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
|
||||
#ifndef PHOENIX_ALGORITHM_DETAIL_BEGIN_HPP
|
||||
#define PHOENIX_ALGORITHM_DETAIL_BEGIN_HPP
|
||||
|
||||
#include <boost/range/result_iterator.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
namespace detail
|
||||
{
|
||||
template<class R>
|
||||
typename range_result_iterator<R>::type
|
||||
begin_(R& r)
|
||||
{
|
||||
return boost::begin(r);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
|
||||
#ifndef PHOENIX_ALGORITHM_DETAIL_DECAY_ARRAY_HPP
|
||||
#define PHOENIX_ALGORITHM_DETAIL_DECAY_ARRAY_HPP
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct decay_array
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T, int N>
|
||||
struct decay_array<T[N]>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
|
||||
#ifndef PHOENIX_ALGORITHM_DETAIL_END_HPP
|
||||
#define PHOENIX_ALGORITHM_DETAIL_END_HPP
|
||||
|
||||
#include <boost/range/result_iterator.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
namespace detail
|
||||
{
|
||||
template<class R>
|
||||
typename range_result_iterator<R>::type
|
||||
end_(R& r)
|
||||
{
|
||||
return boost::end(r);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// has_equal_range.hpp
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef HAS_EQUAL_RANGE_EN_14_12_2004
|
||||
#define HAS_EQUAL_RANGE_EN_14_12_2004
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include "./is_std_map.hpp"
|
||||
#include "./is_std_set.hpp"
|
||||
#include "./is_std_hash_map.hpp"
|
||||
#include "./is_std_hash_set.hpp"
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// Specialize this for user-defined types
|
||||
template<typename T>
|
||||
struct has_equal_range
|
||||
: boost::mpl::or_<
|
||||
boost::mpl::or_<
|
||||
is_std_map<T>
|
||||
, is_std_multimap<T>
|
||||
, is_std_set<T>
|
||||
, is_std_multiset<T>
|
||||
>
|
||||
, boost::mpl::or_<
|
||||
is_std_hash_map<T>
|
||||
, is_std_hash_multimap<T>
|
||||
, is_std_hash_set<T>
|
||||
, is_std_hash_multiset<T>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user