Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54067 - in trunk: boost/proto boost/proto/transform libs/proto/doc/reference/concepts libs/proto/doc/reference/transform
From: eric_at_[hidden]
Date: 2009-06-18 17:39:10


Author: eric_niebler
Date: 2009-06-18 17:39:09 EDT (Thu, 18 Jun 2009)
New Revision: 54067
URL: http://svn.boost.org/trac/boost/changeset/54067

Log:
add a sensible default for proto::_default's template parameter
Text files modified:
   trunk/boost/proto/proto_fwd.hpp | 5 +++++
   trunk/boost/proto/transform/default.hpp | 11 ++++++++++-
   trunk/libs/proto/doc/reference/concepts/BasicPrimitiveTransform.xml | 2 +-
   trunk/libs/proto/doc/reference/transform/default.xml | 9 ++++++++-
   4 files changed, 24 insertions(+), 3 deletions(-)

Modified: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp (original)
+++ trunk/boost/proto/proto_fwd.hpp 2009-06-18 17:39:09 EDT (Thu, 18 Jun 2009)
@@ -188,6 +188,8 @@
         ///
         #define BOOST_PROTO_UNCVREF(X) \
             typename boost::remove_const<typename boost::remove_reference<X>::type>::type
+
+ struct _default;
     }
 
     typedef detail::ignore const ignore;
@@ -744,6 +746,9 @@
     template<typename Grammar>
     struct pass_through;
 
+ template<typename Grammar = detail::_default>
+ struct _default;
+
     struct _expr;
     struct _state;
     struct _data;

Modified: trunk/boost/proto/transform/default.hpp
==============================================================================
--- trunk/boost/proto/transform/default.hpp (original)
+++ trunk/boost/proto/transform/default.hpp 2009-06-18 17:39:09 EDT (Thu, 18 Jun 2009)
@@ -31,7 +31,7 @@
 
     namespace boost { namespace proto
     {
- template<typename Grammar>
+ template<typename Grammar BOOST_PROTO_WHEN_BUILDING_DOCS(= detail::_default)>
         struct _default
           : transform<_default<Grammar> >
         {
@@ -463,6 +463,15 @@
           : mpl::true_
         {};
 
+ namespace detail
+ {
+ // Loopy indirection that allows proto::_default<> to be
+ // used without specifying a Grammar argument.
+ struct _default
+ : proto::_default<>
+ {};
+ }
+
     }}
 
     #endif

Modified: trunk/libs/proto/doc/reference/concepts/BasicPrimitiveTransform.xml
==============================================================================
--- trunk/libs/proto/doc/reference/concepts/BasicPrimitiveTransform.xml (original)
+++ trunk/libs/proto/doc/reference/concepts/BasicPrimitiveTransform.xml 2009-06-18 17:39:09 EDT (Thu, 18 Jun 2009)
@@ -18,7 +18,7 @@
 
   <description>
     <para>
- A PrimitiveTransform is class type that
+ A BasicPrimitiveTransform is class type that
       has a nested class template called impl that takes
       three template parameters representing an expression
       type, a state type and a data type. Specializations

Modified: trunk/libs/proto/doc/reference/transform/default.xml
==============================================================================
--- trunk/libs/proto/doc/reference/transform/default.xml (original)
+++ trunk/libs/proto/doc/reference/transform/default.xml 2009-06-18 17:39:09 EDT (Thu, 18 Jun 2009)
@@ -4,7 +4,9 @@
     <namespace name="proto">
       <struct name="_default">
         <template>
- <template-type-parameter name="Grammar"/>
+ <template-type-parameter name="Grammar">
+ <default><replaceable>unspecified</replaceable></default>
+ </template-type-parameter>
         </template>
         <inherit><classname>proto::transform</classname>&lt; _default&lt;Grammar&gt; &gt;</inherit>
         <purpose>A <conceptname>PrimitiveTransform</conceptname> that gives expressions their
@@ -16,6 +18,11 @@
               <classname>proto::_default::impl&lt;&gt;</classname>
             </computeroutput> class template.
           </para>
+ <para>
+ When used without specifying a <computeroutput>Grammar</computeroutput> parameter,
+ <computeroutput>proto::_default</computeroutput> behaves as if the parameter were
+ <computeroutput>proto::_default&lt;&gt;</computeroutput>.
+ </para>
         </description>
         <struct name="impl">
           <template>


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