|
Boost-Commit : |
From: eric_at_[hidden]
Date: 2008-01-31 02:36:29
Author: eric_niebler
Date: 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
New Revision: 43031
URL: http://svn.boost.org/trac/boost/changeset/43031
Log:
simplify make_expr.hpp, user docs for make_expr()
Text files modified:
trunk/boost/xpressive/proto/make_expr.hpp | 325 +++++----------------------------------
trunk/boost/xpressive/proto/proto_fwd.hpp | 10 +
trunk/libs/xpressive/proto/doc/construction.qbk | 291 +++++++++++++++++++++++++++++++++++
trunk/libs/xpressive/proto/doc/installation.qbk | 2
trunk/libs/xpressive/proto/doc/preface.qbk | 2
trunk/libs/xpressive/proto/doc/protodoc.xml | 115 +------------
trunk/libs/xpressive/proto/test/make_expr.cpp | 2
7 files changed, 357 insertions(+), 390 deletions(-)
Modified: trunk/boost/xpressive/proto/make_expr.hpp
==============================================================================
--- trunk/boost/xpressive/proto/make_expr.hpp (original)
+++ trunk/boost/xpressive/proto/make_expr.hpp 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -70,11 +70,18 @@
#endif
#include <boost/xpressive/proto/detail/suffix.hpp>
- namespace boost { namespace fusion
+ namespace boost
{
- template<typename Function>
- class unfused_generic;
- }}
+ /// INTERNAL ONLY
+ ///
+ namespace fusion
+ {
+ /// INTERNAL ONLY
+ ///
+ template<typename Function>
+ class unfused_generic;
+ }
+ }
namespace boost { namespace proto
{
@@ -558,139 +565,44 @@
template<typename Sig>
struct result {};
+ template<typename This, typename A0>
+ struct result<This(A0)>
+ {
+ typedef
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ , A0
+ >::type
+ type;
+ };
+
/// Construct an expression node with tag type \c Tag
/// and in the domain \c Domain.
template<typename A0>
typename result_of::make_expr<
Tag
, Domain
- , A0
- >::type const
- operator ()(A0 &a0 BOOST_PROTO_DISABLE_IF_IS_CONST(A0)) const
- {
- return proto::detail::make_expr_<
- Tag
- , Domain
- , A0
- >::call(a0);
- }
-
- /// \overload
- ///
- template<typename A0, typename A1>
- typename result_of::make_expr<
- Tag
- , Domain
- , A0
- , A1
- >::type const
- operator ()(A0 &a0, A1 &a1 BOOST_PROTO_DISABLE_IF_IS_CONST(A0) BOOST_PROTO_DISABLE_IF_IS_CONST(A1)) const
- {
- return proto::detail::make_expr_<
- Tag
- , Domain
- , A0
- , A1
- >::call(a0, a1);
- }
-
- /// \overload
- ///
- template<typename A0, typename A1>
- typename result_of::make_expr<
- Tag
- , Domain
- , A0
- , A1 const
- >::type const
- operator ()(A0 &a0, A1 const &a1 BOOST_PROTO_DISABLE_IF_IS_CONST(A0)) const
- {
- return proto::detail::make_expr_<
- Tag
- , Domain
- , A0
- , A1 const
- >::call(a0, a1);
- }
-
- /// \overload
- ///
- template<typename A0, typename A1>
- typename result_of::make_expr<
- Tag
- , Domain
, A0 const
- , A1
>::type const
- operator ()(A0 const &a0, A1 &a1 BOOST_PROTO_DISABLE_IF_IS_CONST(A1)) const
+ operator ()(A0 const &a0) const
{
return proto::detail::make_expr_<
Tag
, Domain
, A0 const
- , A1
- >::call(a0, a1);
+ >::call(a0);
}
+ // Additional overloads generated by the preprocessor ...
+
#define BOOST_PP_ITERATION_PARAMS_1 \
- (4, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 2)) \
+ (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 2)) \
/**/
#include BOOST_PP_ITERATE()
};
- template<typename Domain>
- struct make_expr<tag::terminal, Domain>
- {
- BOOST_PROTO_CALLABLE()
-
- template<typename Sig>
- struct result
- {};
-
- template<typename This, typename A>
- struct result<This(A)>
- {
- typedef
- typename result_of::make_expr<
- tag::terminal
- , Domain
- , A
- >::type
- type;
- };
-
- template<typename A>
- typename result_of::make_expr<
- tag::terminal
- , Domain
- , A
- >::type const
- operator ()(A &a BOOST_PROTO_DISABLE_IF_IS_CONST(A)) const
- {
- return proto::detail::make_expr_<
- tag::terminal
- , Domain
- , A
- >::call(a);
- }
-
- template<typename A>
- typename result_of::make_expr<
- tag::terminal
- , Domain
- , A const
- >::type const
- operator ()(A const &a) const
- {
- return proto::detail::make_expr_<
- tag::terminal
- , Domain
- , A const
- >::call(a);
- }
- };
-
template<typename Tag, typename Domain>
struct unpack_expr
{
@@ -713,18 +625,6 @@
};
template<typename Sequence>
- typename result_of::unpack_expr<Tag, Domain, Sequence>::type const
- operator ()(Sequence &sequence BOOST_PROTO_DISABLE_IF_IS_CONST(Sequence)) const
- {
- return proto::detail::unpack_expr_<
- Tag
- , Domain
- , Sequence
- , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
- >::call(sequence);
- }
-
- template<typename Sequence>
typename result_of::unpack_expr<Tag, Domain, Sequence const>::type const
operator ()(Sequence const &sequence) const
{
@@ -737,6 +637,8 @@
}
};
+ /// INTERNAL ONLY
+ ///
template<typename Tag, typename Domain>
struct unfused_expr_fun
{
@@ -782,6 +684,8 @@
}
};
+ /// INTERNAL ONLY
+ ///
template<typename Tag, typename Domain>
struct unfused_expr
: fusion::unfused_generic<unfused_expr_fun<Tag, Domain> >
@@ -795,23 +699,6 @@
template<typename Tag, typename Sequence>
typename lazy_disable_if<
is_domain<Sequence>
- , result_of::unpack_expr<Tag, Sequence>
- >::type const
- unpack_expr(Sequence &sequence BOOST_PROTO_DISABLE_IF_IS_CONST(Sequence))
- {
- return proto::detail::unpack_expr_<
- Tag
- , deduce_domain
- , Sequence
- , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
- >::call(sequence);
- }
-
- /// \overload
- ///
- template<typename Tag, typename Sequence>
- typename lazy_disable_if<
- is_domain<Sequence>
, result_of::unpack_expr<Tag, Sequence const>
>::type const
unpack_expr(Sequence const &sequence)
@@ -827,20 +714,6 @@
/// \overload
///
template<typename Tag, typename Domain, typename Sequence2>
- typename result_of::unpack_expr<Tag, Domain, Sequence2>::type const
- unpack_expr(Sequence2 &sequence2 BOOST_PROTO_DISABLE_IF_IS_CONST(Sequence2))
- {
- return proto::detail::unpack_expr_<
- Tag
- , Domain
- , Sequence2
- , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence2>::type::value
- >::call(sequence2);
- }
-
- /// \overload
- ///
- template<typename Tag, typename Domain, typename Sequence2>
typename result_of::unpack_expr<Tag, Domain, Sequence2 const>::type const
unpack_expr(Sequence2 const &sequence2)
{
@@ -859,79 +732,16 @@
is_domain<A0>
, result_of::make_expr<
Tag
- , A0
- >
- >::type const
- make_expr(A0 &a0 BOOST_PROTO_DISABLE_IF_IS_CONST(A0))
- {
- return proto::detail::make_expr_<
- Tag
- , deduce_domain
- , A0
- >::call(a0);
- }
-
- /// \overload
- ///
- template<typename Tag, typename A0, typename A1>
- typename lazy_disable_if<
- is_domain<A0>
- , result_of::make_expr<
- Tag
- , A0
- , A1
- >
- >::type const
- make_expr(A0 &a0, A1 &a1 BOOST_PROTO_DISABLE_IF_IS_CONST(A0) BOOST_PROTO_DISABLE_IF_IS_CONST(A1))
- {
- return proto::detail::make_expr_<
- Tag
- , deduce_domain
- , A0
- , A1
- >::call(a0, a1);
- }
-
- /// \overload
- ///
- template<typename Tag, typename A0, typename A1>
- typename lazy_disable_if<
- is_domain<A0>
- , result_of::make_expr<
- Tag
- , A0
- , A1 const
- >
- >::type const
- make_expr(A0 &a0, A1 const &a1 BOOST_PROTO_DISABLE_IF_IS_CONST(A0))
- {
- return proto::detail::make_expr_<
- Tag
- , deduce_domain
- , A0
- , A1 const
- >::call(a0, a1);
- }
-
- /// \overload
- ///
- template<typename Tag, typename A0, typename A1>
- typename lazy_disable_if<
- is_domain<A0>
- , result_of::make_expr<
- Tag
, A0 const
- , A1
>
>::type const
- make_expr(A0 const &a0, A1 &a1 BOOST_PROTO_DISABLE_IF_IS_CONST(A1))
+ make_expr(A0 const &a0)
{
return proto::detail::make_expr_<
Tag
, deduce_domain
, A0 const
- , A1
- >::call(a0, a1);
+ >::call(a0);
}
/// \overload
@@ -940,76 +750,21 @@
typename result_of::make_expr<
Tag
, Domain
- , B0
- >::type const
- make_expr(B0 &b0 BOOST_PROTO_DISABLE_IF_IS_CONST(B0))
- {
- return proto::detail::make_expr_<
- Tag
- , Domain
- , B0
- >::call(b0);
- }
-
- /// \overload
- ///
- template<typename Tag, typename Domain, typename B0, typename B1>
- typename result_of::make_expr<
- Tag
- , Domain
- , B0
- , B1
- >::type const
- make_expr(B0 &b0, B1 &b1 BOOST_PROTO_DISABLE_IF_IS_CONST(B0) BOOST_PROTO_DISABLE_IF_IS_CONST(B1))
- {
- return proto::detail::make_expr_<
- Tag
- , Domain
- , B0
- , B1
- >::call(b0, b1);
- }
-
- /// \overload
- ///
- template<typename Tag, typename Domain, typename B0, typename B1>
- typename result_of::make_expr<
- Tag
- , Domain
- , B0
- , B1 const
- >::type const
- make_expr(B0 &b0, B1 const &b1 BOOST_PROTO_DISABLE_IF_IS_CONST(B0))
- {
- return proto::detail::make_expr_<
- Tag
- , Domain
- , B0
- , B1 const
- >::call(b0, b1);
- }
-
- /// \overload
- ///
- template<typename Tag, typename Domain, typename B0, typename B1>
- typename result_of::make_expr<
- Tag
- , Domain
, B0 const
- , B1
>::type const
- make_expr(B0 const &b0, B1 &b1 BOOST_PROTO_DISABLE_IF_IS_CONST(B1))
+ make_expr(B0 const &b0)
{
return proto::detail::make_expr_<
Tag
, Domain
, B0 const
- , B1
- >::call(b0, b1);
+ >::call(b0);
}
+ // Additional overloads generated by the preprocessor...
+
#define BOOST_PP_ITERATION_PARAMS_1 \
- (4, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 3)) \
+ (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 3)) \
/**/
#include BOOST_PP_ITERATE()
@@ -1024,6 +779,8 @@
: mpl::true_
{};
+ /// INTERNAL ONLY
+ ///
template<typename Tag, typename Domain>
struct is_callable<functional::unfused_expr<Tag, Domain> >
: mpl::true_
Modified: trunk/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/xpressive/proto/proto_fwd.hpp (original)
+++ trunk/boost/xpressive/proto/proto_fwd.hpp 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -76,6 +76,16 @@
///
struct false_ {};
}
+
+ /// INTERNAL ONLY
+ ///
+ namespace fusion
+ {
+ /// INTERNAL ONLY
+ ///
+ template<typename Function>
+ class unfused_generic {};
+ }
}
#endif
Modified: trunk/libs/xpressive/proto/doc/construction.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/construction.qbk (original)
+++ trunk/libs/xpressive/proto/doc/construction.qbk 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -5,7 +5,11 @@
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
+[def __implelemtation_defined__ [~implementation-defined]]
+
+[/=======================================================================================]
[section:expression_construction Expression Construction: Building Proto Expression Trees]
+[/=======================================================================================]
We've seen some simple examples of how to use Proto, but we haven't really said
much about what is going on under the hood. How exactly does Proto build and
@@ -26,7 +30,7 @@
The _expr_ template is the most important type in Proto. Although you will
rarely need to deal with it directly, it's always there behind the scenes
holding your expression trees together. In fact, _expr_ /is/ the expression
-tree -- braches, leaves and all.
+tree -- branches, leaves and all.
The _expr_ template makes up the nodes in expression trees. The first template
parameter is the node type; in this case, `proto::tag::terminal`. That means
@@ -55,7 +59,9 @@
is of type `placeholder1`. Note that we use braces to initialize `_1.arg0`
because `placeholder1` is also an aggregate.
+[/====================================================]
[section:operator_overloads Proto's Operator Overloads]
+[/====================================================]
Once we have some Proto terminals, expressions involving those terminals build
expression trees for us, as if by magic. It's not magic; Proto defines
@@ -80,7 +86,9 @@
[endsect]
+[/=================================================]
[section:expression_trees Building Expression Trees]
+[/=================================================]
The `_1` node is an _expr_ type, and new nodes created with this type are
also _expr_ types. They look like this:
@@ -129,13 +137,17 @@
[endsect]
+[/==============================================]
[section:left_right_arg Accessing Children Nodes]
+[/==============================================]
-// TODO describe tag_of, arg, arg_c, left and right. Maybe also children_of and Fusion.
+// TODO describe tag_of, arg, arg_c, left and right. Also Fusion compatibility.
[endsect]
+[/===============================================================]
[section:tags_and_meta_functions Operator Tags and Meta-Functions]
+[/===============================================================]
The following table lists the overloadable C++ operators, the Proto tag types
for each, and the name of the Proto meta-function for generating the
@@ -327,9 +339,282 @@
[endsect]
+[/===========================================================]
[section:construction_utils Expression Construction Utilities]
+[/===========================================================]
+
+Proto gives you many other ways of creating expression trees besides the operator
+overloads. These are useful for building nodes with custom tag types that don't
+correspond to any C++ operator. They're also useful when writing tree transforms
+that manipulate the structure of the expression tree, as we'll see.
+
+Below are the tools and a brief description of each.
+
+[variablelist
+[ [`make_expr()`]
+ [A function that takes a tag type and children nodes and
+ builds a parent node of the requested type.]]
+[ [`unpack_expr()`]
+ [A function that does the same as `make_expr()` except
+ the children nodes are specified as a Fusion sequence.]]
+[ [`BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE()`]
+ [A macro that generates a number of overloads of a
+ user-specified function template that behaves like
+ `make_expr()`.]]
+]
+
+[/====================================================]
+[heading Building Expression Trees With [^make_expr()]]
+[/====================================================]
+
+[:[*Synopsys:]]
+
+ namespace proto
+ {
+ namespace result_of
+ {
+ // Metafunction for calculating the return type
+ // of the make_expr() function
+ template<
+ typename Tag
+ , typename DomainOrArg
+ , typename... A
+ >
+ struct make_expr
+ {
+ typedef __implelemtation_defined__ type;
+ };
+ }
+
+ namespace functional
+ {
+ // A callable function object equivalent of the
+ // make_expr() function.
+ template<typename Tag, typename Domain = default_domain>
+ struct make_expr : callable
+ {
+ template<typename Sig> struct result;
+
+ template<typename This, typename... A>
+ struct result<This(A...)>
+ : result_of::make_expr<Tag, Domain, A...>
+ {};
+
+ template<typename... A>
+ typename result_of::make_expr<Tag, Domain, const A...>::type
+ operator ()(A const &... a) const;
+ };
+ }
+
+ // The make_expr() function
+ template<typename Tag, typename Domain, typename... A>
+ typename result_of::make_expr<Tag, Domain, A...>::type
+ make_expr(A const &... a);
+ }
+
+You can use the `make_expr()` function to build an expression tree node with
+a specified tag type, as follows.
+
+ // Some user-defined tag type
+ struct MyTag {};
+
+ // Construct a node with MyTag tag type, and
+ // two terminals as children.
+ int i = 0;
+ proto::make_expr<MyTag, default_domain>(i, 'a');
+
+You are not required to specify a domain. If you choose not to, `default_domain`
+is assumed. So the above is equivalent to:
+
+ // Construct a node with MyTag tag type, and
+ // two terminals as children.
+ int i = 0;
+ proto::make_expr<MyTag>(i, 'a');
+
+The return type of the above function invocation can be calculated with the
+`result_of::make_expr<>` metafunction.
+
+ // Use result_of::make_expr<> to compute the return type:
+ int i = 0;
+ typedef
+ proto::result_of::make_expr<
+ MyTag
+ , int
+ , char
+ >::type
+ expr_type;
+
+ expr_type expr = proto::make_expr<MyTag>(i, 'a');
+
+ // expr_type is the same as this type:
+ typedef
+ proto::binary_expr<
+ MyTag
+ , proto::terminal<int>::type
+ , proto::terminal<char>::type
+ >::type
+ expr_type2;
+
+ BOOST_MPL_ASSERT((is_same<expr_type2, expr_type>));
+
+Notice that the children, an int and a char, are wrapped in terminal
+nodes and held by value. If you would like an argument to be beld by
+reference in the resulting tree node, you can use `boost::ref()`:
+
+ // One terminal held by reference:
+ int i = 0;
+
+ typedef
+ proto::result_of::make_expr<
+ MyTag
+ , int & // <-- Note reference here
+ , char
+ >::type
+ expr_type;
+
+ expr_type expr = proto::make_expr<MyTag>(boost::ref(i), 'a');
+
+In the return type calculation, we can specify by-ref with
+`int &`, but we need `boost::ref()` in the actual function invocation.
+That's because the `make_expr()` function can't tell from the function
+arguments whether you want to store the arguments by value or by
+reference.
+
+Non-terminals are handled similarly. Given the non-terminal `expr` as
+defined above, we could wrap it in a unary plus node by value or by
+reference as follows:
+
+ // Make "expr" a child node of a new unary plus node, where
+ // "expr" is held by-value:
+ typedef
+ proto::result_of::make_expr<
+ proto::tag::posit
+ , expr_type
+ >::type
+ posit_val_type;
+
+ posit_val_type p1 = proto::make_expr<proto::tag::posit>(expr);
+
+ // Same as above, except "expr" is held by-reference:
+ typedef
+ proto::result_of::make_expr<
+ proto::tag::posit
+ , expr_type & // <-- Note reference here
+ >::type
+ posit_ref_type;
+
+ posit_ref_type p2 = proto::make_expr<proto::tag::posit>(boost::ref(expr));
+
+ // Equivalent to "by-ref" line directly above:
+ posit_ref_type p3 = +expr;
+
+The application of unary `operator+` on the last line is equivalent to
+the by-ref invocation of `make_expr()` because Proto's operator overloads
+always build trees by holding nodes by reference.
+
+If you specify a domain when invoking `make_expr()`, then `make_expr()`
+will use that domain's generator to wrap the resulting node in a
+domain-specific wrapper. In the example below, expressions within the
+`MyDomain` domain are wrapped in a `MyExpr<>` wrapper.
+
+ template<typename Expr>
+ struct MyExpr;
+
+ struct MyDomain
+ : proto::domain<proto::generator<MyExpr> >
+ {};
+
+ // ...
+
+ // Use result_of::make_expr<> to compute the return type:
+ int i = 0;
+ typedef
+ proto::result_of::make_expr<
+ MyTag
+ , MyDomain // <-- Note second template
+ , int // param can be a domain.
+ , char
+ >::type
+ expr_type;
+
+ // Construct an expression within MyDomain:
+ expr_type expr = proto::make_expr<MyTag, MyDomain>(i, 'a');
+
+ // expr_type is the same as this type:
+ typedef
+ // New node is wrapped in MyExpr<>
+ MyExpr<proto::binary_expr<
+ MyTag
+ // Terminals are also wrapped.
+ , MyExpr<proto::terminal<int>::type>
+ , MyExpr<proto::terminal<char>::type>
+ >::type>
+ expr_type2;
+
+ BOOST_MPL_ASSERT((is_same<expr_type2, expr_type>));
+
+[/======================================================]
+[heading Building Expression Trees With [^unpack_expr()]]
+[/======================================================]
+
+[:[*Synopsys:]]
+
+ namespace proto
+ {
+ namespace result_of
+ {
+ // Metafunction for calculating the return type
+ // of the unpack_expr() function
+ template<
+ typename Tag
+ , typename DomainOrSequence
+ , typename SequenceOrVoid = void
+ >
+ struct unpack_expr
+ {
+ typedef __implelemtation_defined__ type;
+ };
+ }
+
+ namespace functional
+ {
+ // A callable function object equivalent of the
+ // unpack_expr() function.
+ template<typename Tag, typename Domain = default_domain>
+ struct unpack_expr : callable
+ {
+ template<typename Sig> struct result;
+
+ template<typename This, typename Sequence>
+ struct result<This(Sequence)>
+ : result_of::unpack_expr<Tag, Domain, Sequence>
+ {};
+
+ template<typename Sequence>
+ typename result_of::unpack_expr<Tag, Domain, Sequence>::type
+ operator ()(Sequence const &sequence) const;
+ };
+ }
+
+ // The unpack_expr() function
+ template<typename Tag, typename Domain, typename Sequence>
+ typename result_of::unpack_expr<Tag, Domain, Sequence>::type
+ unpack_expr(Sequence const &sequence);
+ }
+
+TODO document unpack_expr
+
+[/=====================================================]
+[heading Generating Custom Expression Factory Functions]
+[/=====================================================]
+
+[:[*Synopsys:]]
+
+ #define BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(NAME, DOMAIN, TAG, BOUNDARGS) \
+ /* ... */
+
+TODO document BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE
-// TODO describe make_expr, unpack_expr and BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE
[endsect]
Modified: trunk/libs/xpressive/proto/doc/installation.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/installation.qbk (original)
+++ trunk/libs/xpressive/proto/doc/installation.qbk 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -31,7 +31,7 @@
* Visual C++ 7.1 and higher
* GNU C++ 3.4 and higher
-* Intel on Linun 8.1 and higher
+* Intel on Linux 8.1 and higher
* Intel on Windows 9.1 and higher
[note Please send any questions, comments and bug reports to eric <at> boost-consulting <dot> com.]
Modified: trunk/libs/xpressive/proto/doc/preface.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/preface.qbk (original)
+++ trunk/libs/xpressive/proto/doc/preface.qbk 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -8,7 +8,7 @@
[section Preface]
[:["There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy.]]
-[:[*['-- William Shakespear]]]
+[:[*['-- William Shakespeare]]]
[heading Description]
Modified: trunk/libs/xpressive/proto/doc/protodoc.xml
==============================================================================
--- trunk/libs/xpressive/proto/doc/protodoc.xml (original)
+++ trunk/libs/xpressive/proto/doc/protodoc.xml 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -789,16 +789,13 @@
-</para></description><returns><para>literal<T &>(t) </para></returns><throws><simpara>Will not throw.</simpara></throws><notes><para>The returned value holds the argument by reference. </para></notes></overloaded-function></namespace></namespace></header><header name="boost/xpressive/proto/make_expr.hpp"><para>Definition of the <computeroutput>make_expr()</computeroutput> and <computeroutput>unpack_expr()</computeroutput> utilities for building Proto expression nodes from children nodes or from a Fusion sequence of children nodes, respectively. </para><namespace name="boost"><namespace name="fusion"/><namespace name="proto"><struct-specialization name="is_callable"><template>
+</para></description><returns><para>literal<T &>(t) </para></returns><throws><simpara>Will not throw.</simpara></throws><notes><para>The returned value holds the argument by reference. </para></notes></overloaded-function></namespace></namespace></header><header name="boost/xpressive/proto/make_expr.hpp"><para>Definition of the <computeroutput>make_expr()</computeroutput> and <computeroutput>unpack_expr()</computeroutput> utilities for building Proto expression nodes from children nodes or from a Fusion sequence of children nodes, respectively. </para><namespace name="boost"><namespace name="proto"><struct-specialization name="is_callable"><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Domain"/>
</template><specialization><template-arg>functional::make_expr< Tag</template-arg><template-arg>Domain ></template-arg></specialization><inherit access="public">boost::mpl::true_</inherit></struct-specialization><struct-specialization name="is_callable"><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Domain"/>
- </template><specialization><template-arg>functional::unpack_expr< Tag</template-arg><template-arg>Domain ></template-arg></specialization><inherit access="public">boost::mpl::true_</inherit></struct-specialization><struct-specialization name="is_callable"><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- </template><specialization><template-arg>functional::unfused_expr< Tag</template-arg><template-arg>Domain ></template-arg></specialization><inherit access="public">boost::mpl::true_</inherit></struct-specialization><namespace name="functional"><struct name="make_expr"><template>
+ </template><specialization><template-arg>functional::unpack_expr< Tag</template-arg><template-arg>Domain ></template-arg></specialization><inherit access="public">boost::mpl::true_</inherit></struct-specialization><namespace name="functional"><struct name="make_expr"><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Domain"/>
</template><struct name="result"><template>
@@ -806,42 +803,31 @@
</template></struct><struct-specialization name="result"><template>
<template-type-parameter name="This"/>
<template-type-parameter name="A0"/>
- </template><specialization><template-arg>This(A0)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, typename remove_reference< A0 >::type >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
+ </template><specialization><template-arg>This(A0)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0 >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
<template-type-parameter name="This"/>
<template-type-parameter name="A0"/>
<template-type-parameter name="A1"/>
- </template><specialization><template-arg>This(A0</template-arg><template-arg>A1)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, typename remove_reference< A0 >::type, typename remove_reference< A1 >::type >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
+ </template><specialization><template-arg>This(A0</template-arg><template-arg>A1)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0, A1 >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
<template-type-parameter name="This"/>
<template-type-parameter name="A0"/>
<template-type-parameter name="A1"/>
<template-type-parameter name="A2"/>
- </template><specialization><template-arg>This(A0</template-arg><template-arg>A1</template-arg><template-arg>A2)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, typename remove_reference< A0 >::type, typename remove_reference< A1 >::type, typename remove_reference< A2 >::type >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
+ </template><specialization><template-arg>This(A0</template-arg><template-arg>A1</template-arg><template-arg>A2)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0, A1, A2 >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
<template-type-parameter name="This"/>
<template-type-parameter name="A0"/>
<template-type-parameter name="A1"/>
<template-type-parameter name="A2"/>
<template-type-parameter name="A3"/>
- </template><specialization><template-arg>This(A0</template-arg><template-arg>A1</template-arg><template-arg>A2</template-arg><template-arg>A3)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, typename remove_reference< A0 >::type, typename remove_reference< A1 >::type, typename remove_reference< A2 >::type, typename remove_reference< A3 >::type >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
+ </template><specialization><template-arg>This(A0</template-arg><template-arg>A1</template-arg><template-arg>A2</template-arg><template-arg>A3)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0, A1, A2, A3 >::type</type></typedef></struct-specialization><struct-specialization name="result"><template>
<template-type-parameter name="This"/>
<template-type-parameter name="A0"/>
<template-type-parameter name="A1"/>
<template-type-parameter name="A2"/>
<template-type-parameter name="A3"/>
<template-type-parameter name="A4"/>
- </template><specialization><template-arg>This(A0</template-arg><template-arg>A1</template-arg><template-arg>A2</template-arg><template-arg>A3</template-arg><template-arg>A4)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, typename remove_reference< A0 >::type, typename remove_reference< A1 >::type, typename remove_reference< A2 >::type, typename remove_reference< A3 >::type, typename remove_reference< A4 >::type >::type</type></typedef></struct-specialization><typedef name="proto_is_callable_"><type>void</type></typedef><method-group name="public member functions"><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0 >::type const</type><template>
- <template-type-parameter name="A0"/>
- </template><parameter name="a0"><paramtype>A0 &</paramtype></parameter><description><para>Construct an expression node with tag type <computeroutput>Tag</computeroutput> and in the domain <computeroutput>Domain</computeroutput>. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0, A1 >::type const</type><template>
- <template-type-parameter name="A0"/>
- <template-type-parameter name="A1"/>
- </template><parameter name="a0"><paramtype>A0 &</paramtype></parameter><parameter name="a1"><paramtype>A1 &</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0, A1 const >::type const</type><template>
+ </template><specialization><template-arg>This(A0</template-arg><template-arg>A1</template-arg><template-arg>A2</template-arg><template-arg>A3</template-arg><template-arg>A4)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0, A1, A2, A3, A4 >::type</type></typedef></struct-specialization><typedef name="proto_is_callable_"><type>void</type></typedef><method-group name="public member functions"><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0 const >::type const</type><template>
<template-type-parameter name="A0"/>
- <template-type-parameter name="A1"/>
- </template><parameter name="a0"><paramtype>A0 &</paramtype></parameter><parameter name="a1"><paramtype>A1 const &</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, A0 const, A1 >::type const</type><template>
- <template-type-parameter name="A0"/>
- <template-type-parameter name="A1"/>
- </template><parameter name="a0"><paramtype>A0 const &</paramtype></parameter><parameter name="a1"><paramtype>A1 &</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, const A0 >::type const</type><template>
- <template-type-parameter name="A0"/>
- </template><parameter name="a0"><paramtype>const A0 &</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, const A0, const A1 >::type const</type><template>
+ </template><parameter name="a0"><paramtype>A0 const &</paramtype></parameter><description><para>Construct an expression node with tag type <computeroutput>Tag</computeroutput> and in the domain <computeroutput>Domain</computeroutput>. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, const A0, const A1 >::type const</type><template>
<template-type-parameter name="A0"/>
<template-type-parameter name="A1"/>
</template><parameter name="a0"><paramtype>const A0 &</paramtype></parameter><parameter name="a1"><paramtype>const A1 &</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< Tag, Domain, const A0, const A1, const A2 >::type const</type><template>
@@ -867,37 +853,9 @@
</template></struct><struct-specialization name="result"><template>
<template-type-parameter name="This"/>
<template-type-parameter name="Sequence"/>
- </template><specialization><template-arg>This(Sequence)</template-arg></specialization><typedef name="type"><type><classname>result_of::unpack_expr</classname>< Tag, Domain, typename remove_reference< Sequence >::type >::type</type></typedef></struct-specialization><typedef name="proto_is_callable_"><type>void</type></typedef><method-group name="public member functions"><method name="operator()" cv="const"><type><classname>result_of::unpack_expr</classname>< Tag, Domain, Sequence >::type const</type><template>
- <template-type-parameter name="Sequence"/>
- </template><parameter name="sequence"><paramtype>Sequence &</paramtype></parameter></method><method name="operator()" cv="const"><type><classname>result_of::unpack_expr</classname>< Tag, Domain, Sequence const >::type const</type><template>
+ </template><specialization><template-arg>This(Sequence)</template-arg></specialization><typedef name="type"><type><classname>result_of::unpack_expr</classname>< Tag, Domain, typename remove_reference< Sequence >::type >::type</type></typedef></struct-specialization><typedef name="proto_is_callable_"><type>void</type></typedef><method-group name="public member functions"><method name="operator()" cv="const"><type><classname>result_of::unpack_expr</classname>< Tag, Domain, Sequence const >::type const</type><template>
<template-type-parameter name="Sequence"/>
- </template><parameter name="sequence"><paramtype>Sequence const &</paramtype></parameter></method></method-group></struct><struct name="unfused_expr_fun"><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- </template><struct name="result"><template>
- <template-type-parameter name="Sig"/>
- </template></struct><struct-specialization name="result"><template>
- <template-type-parameter name="This"/>
- <template-type-parameter name="Sequence"/>
- </template><specialization><template-arg>This(Sequence)</template-arg></specialization><typedef name="type"><type><classname>result_of::unpack_expr</classname>< Tag, Domain, typename remove_reference< Sequence >::type >::type</type></typedef></struct-specialization><typedef name="proto_is_callable_"><type>void</type></typedef><method-group name="public member functions"><method name="operator()" cv="const"><type><classname>proto::result_of::unpack_expr</classname>< Tag, Domain, Sequence >::type</type><template>
- <template-type-parameter name="Sequence"/>
- </template><parameter name="sequence"><paramtype>Sequence &</paramtype></parameter></method><method name="operator()" cv="const"><type><classname>proto::result_of::unpack_expr</classname>< Tag, Domain, Sequence const >::type const</type><template>
- <template-type-parameter name="Sequence"/>
- </template><parameter name="sequence"><paramtype>Sequence const &</paramtype></parameter></method></method-group></struct><struct name="unfused_expr"><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- </template><typedef name="proto_is_callable_"><type>void</type></typedef></struct><struct-specialization name="make_expr"><template>
- <template-type-parameter name="Domain"/>
- </template><specialization><template-arg>tag::terminal</template-arg><template-arg>Domain</template-arg></specialization><struct name="result"><template>
- <template-type-parameter name="Sig"/>
- </template></struct><struct-specialization name="result"><template>
- <template-type-parameter name="This"/>
- <template-type-parameter name="A"/>
- </template><specialization><template-arg>This(A)</template-arg></specialization><typedef name="type"><type><classname>result_of::make_expr</classname>< <classname>tag::terminal</classname>, Domain, typename remove_reference< A >::type >::type</type></typedef></struct-specialization><typedef name="proto_is_callable_"><type>void</type></typedef><method-group name="public member functions"><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< <classname>tag::terminal</classname>, Domain, A >::type const</type><template>
- <template-type-parameter name="A"/>
- </template><parameter name="a"><paramtype>A &</paramtype></parameter></method><method name="operator()" cv="const"><type><classname>result_of::make_expr</classname>< <classname>tag::terminal</classname>, Domain, A const >::type const</type><template>
- <template-type-parameter name="A"/>
- </template><parameter name="a"><paramtype>A const &</paramtype></parameter></method></method-group></struct-specialization></namespace><namespace name="result_of"><struct name="unpack_expr"><template>
+ </template><parameter name="sequence"><paramtype>Sequence const &</paramtype></parameter></method></method-group></struct></namespace><namespace name="result_of"><struct name="unpack_expr"><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Sequence"/>
<template-type-parameter name="EnableIf1"/>
@@ -923,64 +881,21 @@
<template-type-parameter name="A2"/>
<template-type-parameter name="A3"/>
<template-type-parameter name="A4"/>
- </template><specialization><template-arg>Tag</template-arg><template-arg>Domain</template-arg><template-arg>A0</template-arg><template-arg>A1</template-arg><template-arg>A2</template-arg><template-arg>A3</template-arg><template-arg>A4</template-arg><template-arg>typename Domain::proto_is_domain_</template-arg></specialization><typedef name="type"><type><emphasis>unspecified</emphasis></type></typedef></struct-specialization></namespace><namespace name="utility"><struct name="static_"><template>
- <template-type-parameter name="T"/>
- </template><data-member name="value" specifiers="static"><type>T const</type></data-member></struct></namespace><overloaded-function name="unpack_expr"><signature><type>lazy_disable_if< is_domain< Sequence >, <classname>result_of::unpack_expr</classname>< Tag, Sequence >>::type const</type><template>
+ </template><specialization><template-arg>Tag</template-arg><template-arg>Domain</template-arg><template-arg>A0</template-arg><template-arg>A1</template-arg><template-arg>A2</template-arg><template-arg>A3</template-arg><template-arg>A4</template-arg><template-arg>typename Domain::proto_is_domain_</template-arg></specialization><typedef name="type"><type><emphasis>unspecified</emphasis></type></typedef></struct-specialization></namespace><overloaded-function name="unpack_expr"><signature><type>lazy_disable_if< is_domain< Sequence >, <classname>result_of::unpack_expr</classname>< Tag, Sequence const >>::type const</type><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Sequence"/>
- </template><parameter name="sequence"><paramtype>Sequence &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< Sequence >, <classname>result_of::unpack_expr</classname>< Tag, Sequence const >>::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Sequence"/>
- </template><parameter name="sequence"><paramtype>Sequence const &</paramtype></parameter></signature><signature><type><classname>result_of::unpack_expr</classname>< Tag, Domain, Sequence2 >::type const</type><template>
+ </template><parameter name="sequence"><paramtype>Sequence const &</paramtype></parameter></signature><signature><type><classname>result_of::unpack_expr</classname>< Tag, Domain, Sequence2 const >::type const</type><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Domain"/>
<template-type-parameter name="Sequence2"/>
- </template><parameter name="sequence2"><paramtype>Sequence2 &</paramtype></parameter></signature><signature><type><classname>result_of::unpack_expr</classname>< Tag, Domain, Sequence2 const >::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- <template-type-parameter name="Sequence2"/>
- </template><parameter name="sequence2"><paramtype>Sequence2 const &</paramtype></parameter></signature><description><para>unpack_expr </para></description></overloaded-function><overloaded-function name="make_expr"><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, A0 >>::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="A0"/>
- </template><parameter name="a0"><paramtype>A0 &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, A0, A1 >>::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="A0"/>
- <template-type-parameter name="A1"/>
- </template><parameter name="a0"><paramtype>A0 &</paramtype></parameter><parameter name="a1"><paramtype>A1 &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, A0, A1 const >>::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="A0"/>
- <template-type-parameter name="A1"/>
- </template><parameter name="a0"><paramtype>A0 &</paramtype></parameter><parameter name="a1"><paramtype>A1 const &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, A0 const, A1 >>::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="A0"/>
- <template-type-parameter name="A1"/>
- </template><parameter name="a0"><paramtype>A0 const &</paramtype></parameter><parameter name="a1"><paramtype>A1 &</paramtype></parameter></signature><signature><type><classname>result_of::make_expr</classname>< Tag, Domain, B0 >::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- <template-type-parameter name="B0"/>
- </template><parameter name="b0"><paramtype>B0 &</paramtype></parameter></signature><signature><type><classname>result_of::make_expr</classname>< Tag, Domain, B0, B1 >::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- <template-type-parameter name="B0"/>
- <template-type-parameter name="B1"/>
- </template><parameter name="b0"><paramtype>B0 &</paramtype></parameter><parameter name="b1"><paramtype>B1 &</paramtype></parameter></signature><signature><type><classname>result_of::make_expr</classname>< Tag, Domain, B0, B1 const >::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- <template-type-parameter name="B0"/>
- <template-type-parameter name="B1"/>
- </template><parameter name="b0"><paramtype>B0 &</paramtype></parameter><parameter name="b1"><paramtype>B1 const &</paramtype></parameter></signature><signature><type><classname>result_of::make_expr</classname>< Tag, Domain, B0 const, B1 >::type const</type><template>
- <template-type-parameter name="Tag"/>
- <template-type-parameter name="Domain"/>
- <template-type-parameter name="B0"/>
- <template-type-parameter name="B1"/>
- </template><parameter name="b0"><paramtype>B0 const &</paramtype></parameter><parameter name="b1"><paramtype>B1 &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, const A0 >>::type const</type><template>
+ </template><parameter name="sequence2"><paramtype>Sequence2 const &</paramtype></parameter></signature><description><para>unpack_expr </para></description></overloaded-function><overloaded-function name="make_expr"><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, A0 const >>::type const</type><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="A0"/>
- </template><parameter name="a0"><paramtype>const A0 &</paramtype></parameter></signature><signature><type><classname>result_of::make_expr</classname>< Tag, Domain, const B0 >::type const</type><template>
+ </template><parameter name="a0"><paramtype>A0 const &</paramtype></parameter></signature><signature><type><classname>result_of::make_expr</classname>< Tag, Domain, B0 const >::type const</type><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Domain"/>
<template-type-parameter name="B0"/>
- </template><parameter name="b0"><paramtype>const B0 &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, const A0, const A1 >>::type const</type><template>
+ </template><parameter name="b0"><paramtype>B0 const &</paramtype></parameter></signature><signature><type>lazy_disable_if< is_domain< A0 >, <classname>result_of::make_expr</classname>< Tag, const A0, const A1 >>::type const</type><template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="A0"/>
<template-type-parameter name="A1"/>
Modified: trunk/libs/xpressive/proto/test/make_expr.cpp
==============================================================================
--- trunk/libs/xpressive/proto/test/make_expr.cpp (original)
+++ trunk/libs/xpressive/proto/test/make_expr.cpp 2008-01-31 02:36:28 EST (Thu, 31 Jan 2008)
@@ -165,7 +165,7 @@
>
{};
-// turn all plus noded to minus nodes:
+// turn all plus nodes to minus nodes:
struct Minus
: or_<
when<terminal<_> >
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