/usr/include/boost/phoenix/core
Edit: /usr/include/boost/phoenix/core/value.hpp (4118B)
/*==============================================================================
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
#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);
}
// Identifies this Expr as a value.
// I think this is wrong. It is identifying all actors as values.
// Yes, it is giving false positives and needs a rethink.
// And this gives no positives.
//template
//struct is_value >
// : mpl::true_
//{};
// Call out actor for special handling
// Is this correct? It applies to any actor.
// In which case why is it here?
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
{
typedef typename result const &, Context &)>::type result_type;
result_type r = boost::phoenix::eval(expr, ctx);
// std::cout << "Evaluating val() = " << r << std::endl;
return r;
}
};
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