/*============================================================================= 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 #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 #include #include #include #include #include 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 struct make_assign_composite; template struct make_index_composite; template struct comma_result; // error no arguments supplied struct error_expecting_arguments { template error_expecting_arguments(T const&) {} }; } template struct eval_result { typedef typename Eval::template result::type type; }; template struct actor : Eval { typedef actor self_type; typedef Eval eval_type; template struct result {}; actor() : Eval() {} actor(Eval const& base) : Eval(base) {} template explicit actor(T0 const& _0) : Eval(_0) {} template 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 , eval_result > >::type nullary_result; nullary_result operator()() const { return eval_type::eval(basic_environment<>()); } template struct result : eval_result< eval_type , basic_environment< typename remove_reference::type > > {}; template typename result::type operator()(T0& _0) const { return eval_type::eval(basic_environment(_0)); } template struct result : eval_result< eval_type , basic_environment< typename remove_reference::type , typename remove_reference::type > > {}; template typename result::type operator()(T0& _0, T1& _1) const { return eval_type::eval(basic_environment(_0, _1)); } template typename detail::make_assign_composite::type operator=(T1 const& a1) const; template typename detail::make_index_composite::type operator[](T1 const& a1) const; // Bring in the rest of the constructors and function call operators #include private: // silence MSVC warning C4512: assignment operator could not be generated actor& operator= (actor const&); }; // 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 struct comma_result; } template typename detail::comma_result::type operator,(actor const& a0, actor const& a1); }} namespace boost { template struct result_of()> { typedef typename phoenix::actor::nullary_result type; }; template struct result_of const()> : result_of()> {}; } #endif