2
0
mirror of https://github.com/boostorg/phoenix.git synced 2026-02-15 01:12:09 +00:00

documentation work

[SVN r68222]
This commit is contained in:
Thomas Heller
2011-01-18 09:13:32 +00:00
parent bbc1f67b41
commit abbc19cd0a
12 changed files with 267 additions and 100 deletions

View File

@@ -29,40 +29,59 @@ namespace boost { namespace phoenix
//
////////////////////////////////////////////////////////////////////////////
template <typename I>
struct argument
namespace detail
{
typedef I type;
typedef typename I::value_type value_type;
static value_type const value = I::value;
bool operator==(argument) const
template <int I>
struct argument
: mpl::int_<I>
{
return true;
}
bool operator==(argument) const
{
return true;
}
template <typename I2>
bool operator==(argument<I2>) const
{
return false;
}
};
template <int I2>
bool operator==(argument<I2>) const
{
return false;
}
};
}
}}
namespace boost {
template <typename I>
struct is_placeholder<phoenix::argument<I> >
: I
template <int I>
struct is_placeholder<phoenix::detail::argument<I> >
: mpl::int_<I>
{};
}
namespace boost { namespace phoenix
{
namespace expression
{
template <int I>
struct argument
{
typedef
actor<
typename proto::terminal<detail::argument<I> >::type
>
type;
static const type make()
{
type const e = {};
return e;
}
};
}
#define BOOST_PHOENIX_ARGUMENT_N(_, N, name) \
actor< \
proto::terminal<argument<mpl::int_<BOOST_PP_INC(N)> > >::type \
> const BOOST_PP_CAT(name, BOOST_PP_INC(N)) = {};
expression::argument<BOOST_PP_INC(N)>::type const \
BOOST_PP_CAT(name, BOOST_PP_INC(N)) = {}; \
/**/
namespace placeholders
{
@@ -75,6 +94,8 @@ namespace boost { namespace phoenix
BOOST_PP_REPEAT(PHOENIX_ARG_LIMIT, BOOST_PHOENIX_ARGUMENT_N, arg)
BOOST_PP_REPEAT(PHOENIX_ARG_LIMIT, BOOST_PHOENIX_ARGUMENT_N, _)
}
#undef BOOST_PHOENIX_ARGUMENT_N
}}
#endif

View File

@@ -22,27 +22,48 @@ namespace boost { namespace phoenix
// function for evaluating references, e.g. ref(123)
//
/////////////////////////////////////////////////////////////////////////////
template <typename T>
struct reference
: proto::terminal<reference_wrapper<T> >
namespace expression
{
typedef actor<typename proto::terminal<reference_wrapper<T> >::type> type;
};
template <typename T>
struct reference
: proto::terminal<reference_wrapper<T> >
{
typedef actor<typename proto::terminal<reference_wrapper<T> >::type> type;
template <typename T>
typename reference<T>::type const
ref(T & t)
{
typename reference<T>::type const e = {{boost::ref(t)}};
return e;
static const type make(T & t)
{
typename reference<T>::type const e = {{boost::ref(t)}};
return e;
}
};
template <typename T>
struct reference<T const>
: proto::terminal<reference_wrapper<T const> >
{
typedef actor<typename proto::terminal<reference_wrapper<T const> >::type> type;
static const type make(T const & t)
{
typename reference<T const>::type const e = {{boost::cref(t)}};
return e;
}
};
}
template <typename T>
typename reference<T const>::type const
typename expression::reference<T>::type const
ref(T & t)
{
return expression::reference<T>::make(t);
}
template <typename T>
typename expression::reference<T const>::type const
cref(T const & t)
{
typename reference<T const>::type const e = {{boost::cref(t)}};
return e;
return expression::reference<T const>::make(t);
}
// Call out boost::reference_wrapper for special handling

View File

@@ -32,18 +32,8 @@ namespace boost { namespace phoenix
struct terminal
: proto::terminal<proto::_>
{};
template <typename Grammar>
struct expr::case_<proto::tag::terminal, Grammar>
: proto::or_<
proto::when<rule::argument , proto::external_transform>
, proto::when<rule::custom_terminal, proto::external_transform>
, proto::when<rule::terminal , proto::external_transform>
>
{};
}
/*
template <typename Grammar>
struct meta_grammar::case_<proto::tag::terminal, Grammar>
: proto::or_<
@@ -52,7 +42,6 @@ namespace boost { namespace phoenix
, proto::when<rule::terminal , proto::external_transform>
>
{};
*/
template <typename Grammar>
struct default_actions::when<rule::custom_terminal, Grammar>

View File

@@ -30,7 +30,7 @@ namespace boost { namespace phoenix
{
typedef actor<typename proto::terminal<T>::type> type;
static type make(T t)
static const type make(T t)
{
typename value<T>::type const e = {{t}};
return e;
@@ -43,7 +43,7 @@ namespace boost { namespace phoenix
{
typedef actor<typename proto::terminal<T* >::type> type;
static type make(T t[N])
static const type make(T t[N])
{
typename value<T *>::type const e = {{t}};
return e;

View File

@@ -73,10 +73,10 @@ namespace boost { namespace phoenix
typedef
typename mpl::eval_if<
is_reference<result_type>
, reference<
, expression::reference<
typename boost::remove_reference<result_type>::type
>
, value<result_type>
, expression::value<result_type>
>::type
type;
};