/*============================================================================= 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 #include #include #include #include #include #include #include #include #define PHOENIX_AS_ACTOR(z, n, data) \ typename mpl::eval_if< \ is_same \ , mpl::identity \ , as_actor_base \ >::type namespace boost { namespace phoenix { /////////////////////////////////////////////////////////////////////////////// // // as_composite 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(_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 inline actor::type> compose() { return actor::type>(); } template inline actor::type> compose(T0 const& _0) { return actor::type>( as_actor::convert(_0) ); } template inline actor::type> compose(T0 const& _0, T1 const& _1) { return actor::type>( as_actor::convert(_0) , as_actor::convert(_1) ); } // Bring in the the rest of the compose overloads #include /////////////////////////////////////////////////////////////////////////////// // // re_curry // // 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