Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-02-19 00:56:53


Author: eric_niebler
Date: 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
New Revision: 43311
URL: http://svn.boost.org/trac/boost/changeset/43311

Log:
more proto documentation tweaks, remove unnecessary result_of::arg_c instantiation
Text files modified:
   trunk/boost/xpressive/detail/static/is_pure.hpp | 2
   trunk/boost/xpressive/detail/static/width_of.hpp | 2
   trunk/boost/xpressive/proto/context/callable.hpp | 11
   trunk/boost/xpressive/proto/context/default.hpp | 7
   trunk/boost/xpressive/proto/context/null.hpp | 6
   trunk/boost/xpressive/proto/domain.hpp | 4
   trunk/boost/xpressive/proto/extends.hpp | 7
   trunk/boost/xpressive/proto/literal.hpp | 5
   trunk/boost/xpressive/proto/matches.hpp | 8
   trunk/boost/xpressive/proto/proto_fwd.hpp | 17
   trunk/boost/xpressive/proto/traits.hpp | 377 ++++++++++++++++++++++++++++++++++-----
   trunk/boost/xpressive/proto/transform/fold.hpp | 2
   trunk/boost/xpressive/proto/transform/make.hpp | 2
   trunk/boost/xpressive/proto/transform/when.hpp | 4
   14 files changed, 375 insertions(+), 79 deletions(-)

Modified: trunk/boost/xpressive/detail/static/is_pure.hpp
==============================================================================
--- trunk/boost/xpressive/detail/static/is_pure.hpp (original)
+++ trunk/boost/xpressive/detail/static/is_pure.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -105,7 +105,7 @@
     // either (s1 = ...) or (a1 = ...) or (set = ...)
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, proto::tag::assign>
- : use_simple_repeat_assign<typename proto::result_of::arg<typename Expr::proto_arg0>::type>
+ : use_simple_repeat_assign<typename proto::result_of::arg<typename Expr::proto_arg0::proto_base_expr>::type>
     {};
 
     template<typename Expr, typename Char>

Modified: trunk/boost/xpressive/detail/static/width_of.hpp
==============================================================================
--- trunk/boost/xpressive/detail/static/width_of.hpp (original)
+++ trunk/boost/xpressive/detail/static/width_of.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -147,7 +147,7 @@
     // either (s1 = ...) or (a1 = ...) or (set = ...)
     template<typename Expr, typename Char>
     struct width_of<Expr, Char, proto::tag::assign>
- : width_of_assign<Expr, Char, typename proto::result_of::arg<typename Expr::proto_arg0>::type>
+ : width_of_assign<Expr, Char, typename proto::result_of::arg<typename Expr::proto_arg0::proto_base_expr>::type>
     {};
 
     template<typename Expr, typename Char>

Modified: trunk/boost/xpressive/proto/context/callable.hpp
==============================================================================
--- trunk/boost/xpressive/proto/context/callable.hpp (original)
+++ trunk/boost/xpressive/proto/context/callable.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -57,13 +57,20 @@
         {
             /// callable_eval
             ///
- template<typename Expr, typename Context, long Arity>
+ template<
+ typename Expr
+ , typename Context
+ , long Arity BOOST_PROTO_FOR_DOXYGEN_ONLY(= Expr::proto_arity::value)
+ >
             struct callable_eval
             {};
 
             /// callable_context
             ///
- template<typename Context, typename DefaultCtx>
+ template<
+ typename Context
+ , typename DefaultCtx BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_context)
+ >
             struct callable_context
             {
                 /// callable_context::eval

Modified: trunk/boost/xpressive/proto/context/default.hpp
==============================================================================
--- trunk/boost/xpressive/proto/context/default.hpp (original)
+++ trunk/boost/xpressive/proto/context/default.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -132,7 +132,12 @@
 
         namespace context
         {
- template<typename Expr, typename Context, typename Tag, long Arity>
+ template<
+ typename Expr
+ , typename Context
+ , typename Tag BOOST_PROTO_FOR_DOXYGEN_ONLY(= typename Expr::proto_tag)
+ , long Arity BOOST_PROTO_FOR_DOXYGEN_ONLY(= Expr::proto_arity::value)
+ >
             struct default_eval
             {};
 

Modified: trunk/boost/xpressive/proto/context/null.hpp
==============================================================================
--- trunk/boost/xpressive/proto/context/null.hpp (original)
+++ trunk/boost/xpressive/proto/context/null.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -23,7 +23,11 @@
     namespace boost { namespace proto { namespace context
     {
 
- template<typename Expr, typename Context, long Arity>
+ template<
+ typename Expr
+ , typename Context
+ , long Arity BOOST_PROTO_FOR_DOXYGEN_ONLY(= Expr::proto_arity::value)
+ >
         struct null_eval
         {};
 

Modified: trunk/boost/xpressive/proto/domain.hpp
==============================================================================
--- trunk/boost/xpressive/proto/domain.hpp (original)
+++ trunk/boost/xpressive/proto/domain.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -112,7 +112,7 @@
         /// \c mpl::false_ otherwise. If \c T inherits from
         /// \c proto::domain\<\>, \c is_domain\<T\> is
         /// \c mpl::true_.
- template<typename T, typename EnableIf>
+ template<typename T, typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)>
         struct is_domain
           : mpl::false_
         {};
@@ -129,7 +129,7 @@
         /// type, it returns that expression's associated
         /// domain. If not, it returns
         /// \c proto::default_domain.
- template<typename T, typename EnableIf>
+ template<typename T, typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)>
         struct domain_of
         {
             typedef default_domain type;

Modified: trunk/boost/xpressive/proto/extends.hpp
==============================================================================
--- trunk/boost/xpressive/proto/extends.hpp (original)
+++ trunk/boost/xpressive/proto/extends.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -342,7 +342,12 @@
 
         /// \brief extends\<\> class template for adding behaviors to a Proto expression template
         ///
- template<typename Expr, typename Derived, typename Domain, typename Tag>
+ template<
+ typename Expr
+ , typename Derived
+ , typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)
+ , typename Tag BOOST_PROTO_FOR_DOXYGEN_ONLY(= typename Expr::proto_tag)
+ >
         struct extends
         {
             extends()

Modified: trunk/boost/xpressive/proto/literal.hpp
==============================================================================
--- trunk/boost/xpressive/proto/literal.hpp (original)
+++ trunk/boost/xpressive/proto/literal.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -31,7 +31,10 @@
         ///
         /// The \c Domain template parameter defaults to
         /// \c proto::default_domain.
- template<typename T, typename Domain>
+ template<
+ typename T
+ , typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)
+ >
         struct literal
           : extends<typename terminal<T>::type, literal<T, Domain>, Domain>
         {

Modified: trunk/boost/xpressive/proto/matches.hpp
==============================================================================
--- trunk/boost/xpressive/proto/matches.hpp (original)
+++ trunk/boost/xpressive/proto/matches.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -142,7 +142,7 @@
             struct vararg_matches_impl;
 
             // vararg_matches
- template<typename Args1, typename Args2, typename Back, bool Can, bool Zero, typename EnableIf = void>
+ template<typename Args1, typename Args2, typename Back, bool Can, bool Zero, typename Void = void>
             struct vararg_matches
               : mpl::false_
             {};
@@ -612,7 +612,11 @@
             /// >
             /// {};
             /// \endcode
- template<typename If, typename Then, typename Else>
+ template<
+ typename If
+ , typename Then BOOST_PROTO_FOR_DOXYGEN_ONLY(= _)
+ , typename Else BOOST_PROTO_FOR_DOXYGEN_ONLY(= not_<_>)
+ >
             struct if_ : proto::callable
             {
                 typedef if_ proto_base_expr;

Modified: trunk/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/xpressive/proto/proto_fwd.hpp (original)
+++ trunk/boost/xpressive/proto/proto_fwd.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -325,10 +325,10 @@
 
     namespace result_of
     {
- template<typename T, typename Domain = default_domain, typename EnableIf = void>
+ template<typename T, typename Domain = default_domain, typename Void = void>
         struct as_expr;
 
- template<typename T, typename Domain = default_domain, typename EnableIf = void>
+ template<typename T, typename Domain = default_domain, typename Void = void>
         struct as_arg;
 
         template<typename Expr, typename N = mpl::long_<0> >
@@ -360,26 +360,26 @@
               , typename A
               , = void BOOST_PP_INTERCEPT
             )
- , typename EnableIf = void
+ , typename Void = void
>
         struct make_expr;
 
- template<typename Tag, typename DomainOrSequence, typename SequenceOrVoid = void, typename EnableIf = void>
+ template<typename Tag, typename DomainOrSequence, typename SequenceOrVoid = void, typename Void = void>
         struct unpack_expr;
 
- template<typename T, typename EnableIf = void>
+ template<typename T, typename Void = void>
         struct is_ref;
 
- template<typename T, typename EnableIf = void>
+ template<typename T, typename Void = void>
         struct is_expr;
 
- template<typename T, typename EnableIf = void>
+ template<typename T, typename Void = void>
         struct is_domain;
 
         template<typename Expr>
         struct tag_of;
 
- template<typename T, typename EnableIf = void>
+ template<typename T, typename Void = void>
         struct domain_of;
 
         template<typename Expr, typename Grammar>
@@ -603,7 +603,6 @@
     namespace transform
     {
         #define BOOST_PROTO_CALLABLE() typedef void proto_is_callable_;
- #define BOOST_PROTO_NOT_CALLABLE() typedef int proto_is_callable_;
 
         struct callable
         {

Modified: trunk/boost/xpressive/proto/traits.hpp
==============================================================================
--- trunk/boost/xpressive/proto/traits.hpp (original)
+++ trunk/boost/xpressive/proto/traits.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -62,7 +62,7 @@
     {
         namespace detail
         {
- template<typename T, typename EnableIf = void>
+ template<typename T, typename Void = void>
             struct if_vararg
             {};
 
@@ -71,7 +71,7 @@
               : T
             {};
 
- template<typename T, typename EnableIf = void>
+ template<typename T, typename Void = void>
             struct is_callable2_
               : mpl::false_
             {};
@@ -322,7 +322,7 @@
             };
 
             /// \brief A metafunction that returns the type of the Nth child
- /// of a Proto expression, where N is an Integral Constant type.
+ /// of a Proto expression, where N is an MPL Integral Constant.
             ///
             /// <tt>result_of::arg\<Expr, N\></tt> is equivalent to
             /// <tt>result_of::arg_c\<Expr, N::value\></tt>.
@@ -2114,17 +2114,27 @@
 
         namespace functional
         {
- template<typename Domain>
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c as_expr() function.
+ template<typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)>
             struct as_expr
             {
+ BOOST_PROTO_CALLABLE()
+
                 template<typename Sig>
                 struct result;
 
                 template<typename This, typename T>
                 struct result<This(T)>
- : result_of::as_expr<typename remove_reference<T>::type, Domain>
- {};
+ {
+ typedef typename remove_reference<T>::type unref_type;
+ typedef typename result_of::as_expr<unref_type, Domain>::type type;
+ };
 
+ /// \brief Wrap an object in a Proto terminal if it isn't a
+ /// Proto expression already.
+ /// \param t The object to wrap.
+ /// \return <tt>proto::as_expr\<Domain\>(t)</tt>
                 template<typename T>
                 typename result_of::as_expr<T, Domain>::reference
                 operator ()(T &t) const
@@ -2132,6 +2142,8 @@
                     return result_of::as_expr<T, Domain>::call(t);
                 }
 
+ /// \overload
+ ///
                 template<typename T>
                 typename result_of::as_expr<T const, Domain>::reference
                 operator ()(T const &t) const
@@ -2156,17 +2168,27 @@
                 #endif
             };
 
- template<typename Domain>
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c as_arg() function.
+ template<typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)>
             struct as_arg
             {
+ BOOST_PROTO_CALLABLE()
+
                 template<typename Sig>
                 struct result;
 
                 template<typename This, typename T>
                 struct result<This(T)>
- : result_of::as_arg<typename remove_reference<T>::type, Domain>
- {};
+ {
+ typedef typename remove_reference<T>::type unref_type;
+ typedef typename result_of::as_arg<unref_type, Domain>::type type;
+ };
 
+ /// \brief Wrap an object in a Proto terminal if it isn't a
+ /// Proto expression already.
+ /// \param t The object to wrap.
+ /// \return <tt>proto::as_arg\<Domain\>(t)</tt>
                 template<typename T>
                 typename result_of::as_arg<T, Domain>::type
                 operator ()(T &t) const
@@ -2174,6 +2196,8 @@
                     return result_of::as_arg<T, Domain>::call(t);
                 }
 
+ /// \overload
+ ///
                 template<typename T>
                 typename result_of::as_arg<T const, Domain>::type
                 operator ()(T const &t) const
@@ -2182,47 +2206,82 @@
                 }
             };
 
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c arg_c() function.
             template<long N>
             struct arg_c
             {
+ BOOST_PROTO_CALLABLE()
+
                 template<typename Sig>
                 struct result;
 
                 template<typename This, typename Expr>
                 struct result<This(Expr)>
- : result_of::arg_c<BOOST_PROTO_UNCVREF(Expr), N>
- {};
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::arg_c<uncvref_type, N>::type type;
+ };
 
+ /// \brief Return the Nth child of the given expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>N == 0 || N \< Expr::proto_arity::value</tt>
+ /// \return <tt>proto::arg_c\<N\>(expr)</tt>
+ /// \throw nothrow
                 template<typename Expr>
- typename result_of::arg_c<Expr, N>::reference operator ()(Expr &expr) const
+ typename result_of::arg_c<Expr, N>::reference
+ operator ()(Expr &expr) const
                 {
                     return result_of::arg_c<Expr, N>::call(expr);
                 }
 
+ /// \overload
+ ///
                 template<typename Expr>
- typename result_of::arg_c<Expr, N>::const_reference operator ()(Expr const &expr) const
+ typename result_of::arg_c<Expr, N>::const_reference
+ operator ()(Expr const &expr) const
                 {
                     return result_of::arg_c<Expr, N>::call(expr);
                 }
             };
 
- template<typename N>
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c arg() function.
+ ///
+ /// A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c arg() function. \c N is required
+ /// to be an MPL Integral Constant.
+ template<typename N BOOST_PROTO_FOR_DOXYGEN_ONLY(= mpl::long_<0>) >
             struct arg
             {
+ BOOST_PROTO_CALLABLE()
+
                 template<typename Sig>
                 struct result;
 
                 template<typename This, typename Expr>
                 struct result<This(Expr)>
- : result_of::arg<BOOST_PROTO_UNCVREF(Expr), N>
- {};
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::arg<uncvref_type, N>::type type;
+ };
 
+ /// \brief Return the Nth child of the given expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>N::value == 0 || N::value \< Expr::proto_arity::value</tt>
+ /// \return <tt>proto::arg\<N\>(expr)</tt>
+ /// \throw nothrow
                 template<typename Expr>
- typename result_of::arg<Expr, N>::reference operator ()(Expr &expr) const
+ typename result_of::arg<Expr, N>::reference
+ operator ()(Expr &expr) const
                 {
                     return result_of::arg<Expr, N>::call(expr);
                 }
 
+ /// \overload
+ ///
                 template<typename Expr>
                 typename result_of::arg<Expr, N>::const_reference operator ()(Expr const &expr) const
                 {
@@ -2230,47 +2289,77 @@
                 }
             };
 
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c left() function.
             struct left
             {
+ BOOST_PROTO_CALLABLE()
+
                 template<typename Sig>
                 struct result;
 
                 template<typename This, typename Expr>
                 struct result<This(Expr)>
- : result_of::left<BOOST_PROTO_UNCVREF(Expr)>
- {};
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::left<uncvref_type>::type type;
+ };
 
+ /// \brief Return the left child of the given binary expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \return <tt>proto::left(expr)</tt>
+ /// \throw nothrow
                 template<typename Expr>
- typename result_of::left<Expr>::reference operator ()(Expr &expr) const
+ typename result_of::left<Expr>::reference
+ operator ()(Expr &expr) const
                 {
                     return proto::unref(expr.proto_base().arg0);
                 }
 
+ /// \overload
+ ///
                 template<typename Expr>
- typename result_of::left<Expr>::const_reference operator ()(Expr const &expr) const
+ typename result_of::left<Expr>::const_reference
+ operator ()(Expr const &expr) const
                 {
                     return proto::unref(expr.proto_base().arg0);
                 }
             };
 
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c right() function.
             struct right
             {
+ BOOST_PROTO_CALLABLE()
+
                 template<typename Sig>
                 struct result;
 
                 template<typename This, typename Expr>
                 struct result<This(Expr)>
- : result_of::right<BOOST_PROTO_UNCVREF(Expr)>
- {};
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::right<uncvref_type>::type type;
+ };
 
+ /// \brief Return the right child of the given binary expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \return <tt>proto::right(expr)</tt>
+ /// \throw nothrow
                 template<typename Expr>
- typename result_of::right<Expr>::reference operator ()(Expr &expr) const
+ typename result_of::right<Expr>::reference
+ operator ()(Expr &expr) const
                 {
                     return proto::unref(expr.proto_base().arg1);
                 }
 
                 template<typename Expr>
- typename result_of::right<Expr>::const_reference operator ()(Expr const &expr) const
+ typename result_of::right<Expr>::const_reference
+ operator ()(Expr const &expr) const
                 {
                     return proto::unref(expr.proto_base().arg1);
                 }
@@ -2278,11 +2367,28 @@
 
         }
 
- functional::left const left = {};
- functional::right const right = {};
-
- /// as_expr
+ /// \brief A function that wraps non-Proto expression types in Proto
+ /// terminals and leaves Proto expression types alone.
+ ///
+ /// The <tt>as_expr()</tt> function turns objects into Proto terminals if
+ /// they are not Proto expression types already. Non-Proto types are
+ /// held by value, if possible. Types which are already Proto types are
+ /// left alone and returned by reference.
+ ///
+ /// This function can be called either with an explicitly specified
+ /// \c Domain parameter (i.e., <tt>as_expr\<Domain\>(t)</tt>), or
+ /// without (i.e., <tt>as_expr(t)</tt>). If no domain is
+ /// specified, \c default_domain is assumed.
         ///
+ /// If <tt>is_expr\<T\>::::value</tt> is \c true, then the argument is
+ /// returned unmodified, by reference. Otherwise, the argument is wrapped
+ /// in a Proto terminal expression node according to the following rules.
+ /// If \c T is an array type or a function type, let \c A be <tt>T &</tt>.
+ /// Otherwise, let \c A be the type \c T stripped of cv-qualifiers.
+ /// Then, \c as_expr() returns
+ /// <tt>Domain::make(terminal\<A\>::::type::make(t))</tt>.
+ ///
+ /// \param t The object to wrap.
         template<typename T>
         typename result_of::as_expr<T>::reference
         as_expr(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
@@ -2317,8 +2423,26 @@
             return result_of::as_expr<T const, Domain>::call(t);
         }
 
- /// as_arg
+ /// \brief A function that wraps non-Proto expression types in Proto
+ /// terminals (by reference) and wraps Proto expression types in
+ /// <tt>ref_\<\></tt>.
+ ///
+ /// The <tt>as_arg()</tt> function turns objects into Proto terminals if
+ /// they are not Proto expression types already. Non-Proto types are
+ /// held by reference. Types which are already Proto types are wrapped
+ /// in <tt>ref_\<\></tt>.
+ ///
+ /// This function can be called either with an explicitly specified
+ /// \c Domain parameter (i.e., <tt>as_arg\<Domain\>(t)</tt>), or
+ /// without (i.e., <tt>as_arg(t)</tt>). If no domain is
+ /// specified, \c default_domain is assumed.
         ///
+ /// If <tt>is_expr\<T\>::::value</tt> is \c true, then the argument is
+ /// wrapped in <tt>ref_\<\></tt>, which holds the argument by reference.
+ /// Otherwise, \c as_arg() returns
+ /// <tt>Domain::make(terminal\<T &\>::::type::make(t))</tt>.
+ ///
+ /// \param t The object to wrap.
         template<typename T>
         typename result_of::as_arg<T>::type
         as_arg(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
@@ -2353,44 +2477,65 @@
             return result_of::as_arg<T const, Domain>::call(t);
         }
 
- /// arg
+ /// \brief Return the Nth child of the specified Proto expression.
+ ///
+ /// Return the Nth child of the specified Proto expression. If
+ /// \c N is not specified, as in \c arg(expr), then \c N is assumed
+ /// to be <tt>mpl::long_\<0\></tt>. The child is returned by
+ /// reference. If the expression is holding the child in a
+ /// <tt>ref_\<\></tt> wrapper, it is unwrapped before it is returned.
         ///
- template<typename Expr>
- typename result_of::unref<typename Expr::proto_base_expr::proto_arg0>::reference
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre \c N is an MPL Integral Constant.
+ /// \pre <tt>N::value == 0 || N::value \< Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the Nth child
+ template<typename N, typename Expr>
+ typename result_of::arg<Expr, N>::reference
         arg(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
         {
- return proto::unref(expr.proto_base().arg0);
+ return result_of::arg<Expr, N>::call(expr);
         }
 
         /// \overload
         ///
- template<typename Expr>
- typename result_of::unref<typename Expr::proto_base_expr::proto_arg0>::const_reference
+ template<typename N, typename Expr>
+ typename result_of::arg<Expr, N>::const_reference
         arg(Expr const &expr)
         {
- return proto::unref(expr.proto_base().arg0);
+ return result_of::arg<Expr, N>::call(expr);
         }
 
         /// \overload
         ///
- template<typename N, typename Expr>
- typename result_of::arg<Expr, N>::reference
- arg(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ template<typename Expr2>
+ typename result_of::unref<typename Expr2::proto_base_expr::proto_arg0>::reference
+ arg(Expr2 &expr2 BOOST_PROTO_DISABLE_IF_IS_CONST(Expr2))
         {
- return result_of::arg<Expr, N>::call(expr);
+ return proto::unref(expr2.proto_base().arg0);
         }
 
         /// \overload
         ///
- template<typename N, typename Expr>
- typename result_of::arg<Expr, N>::const_reference
- arg(Expr const &expr)
+ template<typename Expr2>
+ typename result_of::unref<typename Expr2::proto_base_expr::proto_arg0>::const_reference
+ arg(Expr2 const &expr2)
         {
- return result_of::arg<Expr, N>::call(expr);
+ return proto::unref(expr2.proto_base().arg0);
         }
 
- /// arg_c
+ /// \brief Return the Nth child of the specified Proto expression.
+ ///
+ /// Return the Nth child of the specified Proto expression. The child
+ /// is returned by reference. If the expression is holding the child in
+ /// a <tt>ref_\<\></tt> wrapper, it is unwrapped before it is returned.
         ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre <tt>N == 0 || N \< Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the Nth child
         template<long N, typename Expr>
         typename result_of::arg_c<Expr, N>::reference
         arg_c(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
@@ -2401,11 +2546,98 @@
         /// \overload
         ///
         template<long N, typename Expr>
- typename result_of::arg_c<Expr, N>::const_reference arg_c(Expr const &expr)
+ typename result_of::arg_c<Expr, N>::const_reference
+ arg_c(Expr const &expr)
         {
             return result_of::arg_c<Expr, N>::call(expr);
         }
 
+ /// \brief Return the left child of the specified binary Proto
+ /// expression.
+ ///
+ /// Return the left child of the specified binary Proto expression. The
+ /// child is returned by reference. If the expression is holding the
+ /// child in a <tt>ref_\<\></tt> wrapper, it is unwrapped before it is
+ /// returned.
+ ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the left child
+ template<typename Expr>
+ typename result_of::left<Expr>::reference
+ left(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ {
+ return proto::unref(expr.proto_base().arg0);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::left<Expr>::const_reference
+ left(Expr const &expr)
+ {
+ return proto::unref(expr.proto_base().arg0);
+ }
+
+ /// \brief Return the right child of the specified binary Proto
+ /// expression.
+ ///
+ /// Return the right child of the specified binary Proto expression. The
+ /// child is returned by reference. If the expression is holding the
+ /// child in a <tt>ref_\<\></tt> wrapper, it is unwrapped before it is
+ /// returned.
+ ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the right child
+ template<typename Expr>
+ typename result_of::right<Expr>::reference
+ right(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ {
+ return proto::unref(expr.proto_base().arg1);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::right<Expr>::const_reference
+ right(Expr const &expr)
+ {
+ return proto::unref(expr.proto_base().arg1);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Domain>
+ struct is_callable<functional::as_expr<Domain> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Domain>
+ struct is_callable<functional::as_arg<Domain> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<long N>
+ struct is_callable<functional::arg_c<N> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename N>
+ struct is_callable<functional::arg<N> >
+ : mpl::true_
+ {};
+
     }}
 
     #if BOOST_WORKAROUND( BOOST_MSVC, >= 1400 )
@@ -2553,33 +2785,70 @@
 
         namespace result_of
         {
+ /// \brief A metafunction that returns the type of the Nth child
+ /// of a Proto expression.
+ ///
+ /// A metafunction that returns the type of the Nth child
+ /// of a Proto expression. \c N must be 0 or less than
+ /// \c Expr::proto_arity::value.
             template<typename Expr>
             struct arg_c<Expr, N>
             {
+ /// The raw type of the Nth child as it is stored within
+ /// \c Expr. This may be a value, a reference, or a Proto
+ /// <tt>ref_\<\></tt> wrapper.
                 typedef typename Expr::BOOST_PP_CAT(proto_arg, N) wrapped_type;
+
+ /// The "value" type of the child, suitable for return by value,
+ /// computed as follows:
+ /// \li <tt>ref_\<T const\></tt> becomes <tt>T</tt>
+ /// \li <tt>ref_\<T\></tt> becomes <tt>T</tt>
+ /// \li <tt>T const(&)[N]</tt> becomes <tt>T const(&)[N]</tt>
+ /// \li <tt>T(&)[N]</tt> becomes <tt>T(&)[N]</tt>
+ /// \li <tt>R(&)(A0,...)</tt> becomes <tt>R(&)(A0,...)</tt>
+ /// \li <tt>T const &</tt> becomes <tt>T</tt>
+ /// \li <tt>T &</tt> becomes <tt>T</tt>
+ /// \li <tt>T</tt> becomes <tt>T</tt>
                 typedef typename unref<wrapped_type>::type type;
+
+ /// The "reference" type of the child, suitable for return by
+ /// reference, computed as follows:
+ /// \li <tt>ref_\<T const\></tt> becomes <tt>T const &</tt>
+ /// \li <tt>ref_\<T\></tt> becomes <tt>T &</tt>
+ /// \li <tt>T const(&)[N]</tt> becomes <tt>T const(&)[N]</tt>
+ /// \li <tt>T(&)[N]</tt> becomes <tt>T(&)[N]</tt>
+ /// \li <tt>R(&)(A0,...)</tt> becomes <tt>R(&)(A0,...)</tt>
+ /// \li <tt>T const &</tt> becomes <tt>T const &</tt>
+ /// \li <tt>T &</tt> becomes <tt>T &</tt>
+ /// \li <tt>T</tt> becomes <tt>T &</tt>
                 typedef typename unref<wrapped_type>::reference reference;
+
+ /// The "const reference" type of the child, suitable for return by
+ /// const reference, computed as follows:
+ /// \li <tt>ref_\<T const\></tt> becomes <tt>T const &</tt>
+ /// \li <tt>ref_\<T\></tt> becomes <tt>T &</tt>
+ /// \li <tt>T const(&)[N]</tt> becomes <tt>T const(&)[N]</tt>
+ /// \li <tt>T(&)[N]</tt> becomes <tt>T(&)[N]</tt>
+ /// \li <tt>R(&)(A0,...)</tt> becomes <tt>R(&)(A0,...)</tt>
+ /// \li <tt>T const &</tt> becomes <tt>T const &</tt>
+ /// \li <tt>T &</tt> becomes <tt>T &</tt>
+ /// \li <tt>T</tt> becomes <tt>T const &</tt>
                 typedef typename unref<wrapped_type>::const_reference const_reference;
 
                 /// INTERNAL ONLY
                 ///
- static reference call(Expr &expr)
+ static reference call(typename Expr::proto_derived_expr &expr)
                 {
                     return proto::unref(expr.proto_base().BOOST_PP_CAT(arg, N));
                 }
 
                 /// INTERNAL ONLY
                 ///
- static const_reference call(Expr const &expr)
+ static const_reference call(typename Expr::proto_derived_expr const &expr)
                 {
                     return proto::unref(expr.proto_base().BOOST_PP_CAT(arg, N));
                 }
             };
-
- template<typename Expr>
- struct arg_c<Expr const, N>
- : arg_c<Expr, N>
- {};
         }
 
     #undef N

Modified: trunk/boost/xpressive/proto/transform/fold.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/fold.hpp (original)
+++ trunk/boost/xpressive/proto/transform/fold.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -75,7 +75,7 @@
                 };
 
                 #if BOOST_VERSION < 103500
- template<typename Sequence, typename EnableIf = void>
+ template<typename Sequence, typename Void = void>
                 struct as_fusion_sequence_type
                 {
                     typedef Sequence const type;

Modified: trunk/boost/xpressive/proto/transform/make.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/make.hpp (original)
+++ trunk/boost/xpressive/proto/transform/make.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -60,7 +60,7 @@
                     typedef T type;
                 };
 
- template<typename T, typename Args, typename EnableIf = void>
+ template<typename T, typename Args, typename Void = void>
                 struct nested_type_if
                   : nested_type<T>
                 {};

Modified: trunk/boost/xpressive/proto/transform/when.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/when.hpp (original)
+++ trunk/boost/xpressive/proto/transform/when.hpp 2008-02-19 00:56:52 EST (Tue, 19 Feb 2008)
@@ -26,9 +26,9 @@
     {
         // Simple transform, takes a raw transform and
         // applies it directly.
- template<typename Grammar, typename Fun>
+ template<typename Grammar, typename PrimitiveTransform BOOST_PROTO_FOR_DOXYGEN_ONLY(= Grammar)>
         struct when
- : Fun
+ : PrimitiveTransform
         {
             typedef typename Grammar::proto_base_expr proto_base_expr;
         };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk