/*============================================================================== Copyright (c) 2001-2010 Joel de Guzman Copyright (c) 2010 Thomas Heller 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_PHOENIX_CORE_VALUE_HPP #define BOOST_PHOENIX_CORE_VALUE_HPP #include #include #include #include #include namespace boost { namespace phoenix { //////////////////////////////////////////////////////////////////////////// // // values // // function for evaluating values, e.g. val(123) // //////////////////////////////////////////////////////////////////////////// namespace expression { template struct value : expression::terminal { typedef typename expression::terminal::type type; /* static const type make(T & t) { typename value::type const e = {{t}}; return e; } */ }; } template inline typename expression::value::type const val(T t) { return expression::value::make(t); } // Call out actor for special handling template struct is_custom_terminal > : mpl::true_ {}; // Special handling for actor template struct custom_terminal > { template struct result; template struct result : boost::remove_const< typename boost::remove_reference< typename evaluator::impl::result_type >::type > {}; template typename result const &, Context &)>::type operator()(actor const & expr, Context & ctx) const { return boost::phoenix::eval(expr, ctx); } }; namespace meta { template struct const_ref : add_reference::type> {}; template struct argument_type : mpl::eval_if_c< is_function::type>::value , mpl::identity , const_ref > { typedef T type; }; template struct decay { typedef T type; }; template struct decay : decay {}; } template struct as_actor { typedef typename expression::value::type >::type type; static type convert(typename meta::argument_type::type>::type t) { return expression::value::type >::make(t); } }; }} #endif