namespace reform, begin to make proto internals rely less on proto::expr

[SVN r62550]
This commit is contained in:
Eric Niebler 2010-06-08 05:07:00 +00:00
parent 180e75b2d1
commit eac363c3df
19 changed files with 1522 additions and 1646 deletions

View File

@ -63,6 +63,19 @@
</description>
</associated-type>
<associated-type name="proto_super_domain">
<get-member-type name="proto_super_domain">
<type name="Domain"/>
</get-member-type>
<description>
<simpara>
The Domain that is a super-domain of this domain, if
any such domain exists. If not, it is some unspecified
type.
</simpara>
</description>
</associated-type>
<associated-type name="result_type">
<get-member-type name="type">
<apply-template name="boost::result_of">

View File

@ -72,6 +72,22 @@
</description>
</associated-type>
<associated-type name="proto_grammar">
<get-member-type name="proto_grammar">
<type name="Expr"/>
</get-member-type>
<description>
<simpara>
A typedef for an instantiation of
<classname alt="boost::proto::basic_expr">
<code>proto::basic_expr&lt;&gt;</code>
</classname>
that is equivalent to Expr. Expression types are equivalent if they have the
same <code>proto_tag</code>, <code>proto_args</code>, and <code>proto_arity</code>.
</simpara>
</description>
</associated-type>
<associated-type name="proto_base_expr">
<get-member-type name="proto_base_expr">
<type name="Expr"/>

View File

@ -3,6 +3,20 @@
<namespace name="boost">
<namespace name="proto">
<!-- boost::proto::basic_expr -->
<struct name="basic_expr">
<template>
<template-type-parameter name="Tag"/>
<template-type-parameter name="Args"/>
<template-nontype-parameter name="Arity">
<type>long</type>
</template-nontype-parameter>
</template>
<purpose>Simplified representation of a node in an expression tree.</purpose>
</struct>
<!-- boost::proto::expr -->
<struct name="expr">
@ -71,6 +85,10 @@
<type><classname>proto::default_domain</classname></type>
</typedef>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; Tag, Args, Arity &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>expr</type>
</typedef>

View File

@ -136,6 +136,9 @@ struct my_expr
<typedef name="proto_arity">
<type>typename proto_base_expr::proto_arity</type>
</typedef>
<typedef name="proto_grammar">
<type>typename proto_base_expr::proto_grammar</type>
</typedef>
<typedef name="proto_childN">
<purpose>For each <replaceable>N</replaceable> in <replaceable>[0,max(1,proto_arity_c))</replaceable></purpose>
<type>typename proto_base_expr::proto_child<replaceable>N</replaceable></type>

View File

@ -82,7 +82,7 @@
</method>
</method-group>
</struct>
<typedef name="proto_base_expr">
<typedef name="proto_grammar">
<type>_</type>
</typedef>
</struct>
@ -144,7 +144,7 @@
</method>
</method-group>
</struct>
<typedef name="proto_base_expr">
<typedef name="proto_grammar">
<type>not_</type>
</typedef>
</struct>
@ -262,7 +262,7 @@ struct IsIntegral2 :
</method>
</method-group>
</struct>
<typedef name="proto_base_expr">
<typedef name="proto_grammar">
<type>if_</type>
</typedef>
</struct>
@ -345,7 +345,7 @@ struct IsIntegral2 :
</method>
</method-group>
</struct>
<typedef name="proto_base_expr">
<typedef name="proto_grammar">
<type>or_</type>
</typedef>
</struct>
@ -418,7 +418,7 @@ struct IsIntegral2 :
</method>
</method-group>
</struct>
<typedef name="proto_base_expr">
<typedef name="proto_grammar">
<type>and_</type>
</typedef>
</struct>
@ -457,7 +457,7 @@ struct IsIntegral2 :
<inherit><type>
Cases::template case_&lt;typename Expr::tag_type&gt;::template impl&lt;Expr, State, Data&gt;</type></inherit>
</struct>
<typedef name="proto_base_expr">
<typedef name="proto_grammar">
<type>switch_</type>
</typedef>
</struct>
@ -541,8 +541,8 @@ struct Function :
<para>
<computeroutput>proto::matches&lt;Expr, Grammar&gt;</computeroutput> inherits from
<computeroutput>mpl::true_</computeroutput> if
<computeroutput>Expr::proto_base_expr</computeroutput> matches
<computeroutput>Grammar::proto_base_expr</computeroutput>, and from
<computeroutput>Expr::proto_grammar</computeroutput> matches
<computeroutput>Grammar::proto_grammar</computeroutput>, and from
<computeroutput>mpl::false_</computeroutput> otherwise.
</para>
<para>

View File

@ -595,8 +595,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::terminal</classname>, <classname>proto::term</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::terminal</classname>, <classname>proto::term</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -626,8 +626,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::if_else_</classname>, <classname alt="proto::listN">proto::list3</classname>&lt; T, U, V &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::if_else_</classname>, <classname alt="proto::listN">proto::list3</classname>&lt; T, U, V &gt; &gt;</type>
</typedef>
</struct>
@ -654,8 +654,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::unary_plus</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::unary_plus</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -682,8 +682,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::negate</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::negate</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -710,8 +710,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::dereference</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::dereference</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -738,8 +738,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::complement</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::complement</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -766,8 +766,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::address_of</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::address_of</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -794,8 +794,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::logical_not</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::logical_not</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -822,8 +822,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::pre_inc</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::pre_inc</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -850,8 +850,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::pre_dec</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::pre_dec</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -878,8 +878,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::post_inc</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::post_inc</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -906,8 +906,10 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::post_dec</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type>
<classname>proto::basic_expr</classname>&lt; <classname>proto::tag::post_dec</classname>, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;
</type>
</typedef>
</struct>
@ -935,8 +937,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::shift_left</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::shift_left</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -964,8 +966,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::shift_right</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::shift_right</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -993,8 +995,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::multiplies</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::multiplies</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1022,8 +1024,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::divides</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::divides</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1051,8 +1053,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::modulus</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::modulus</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1080,8 +1082,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::plus</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::plus</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1109,8 +1111,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::minus</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::minus</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1138,8 +1140,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::less</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::less</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1167,8 +1169,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::greater</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::greater</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1196,8 +1198,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::less_equal</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::less_equal</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1225,8 +1227,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::greater_equal</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::greater_equal</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1254,8 +1256,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::equal_to</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::equal_to</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1283,8 +1285,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::not_equal_to</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::not_equal_to</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1312,8 +1314,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::logical_or</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::logical_or</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1341,8 +1343,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::logical_and</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::logical_and</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1370,8 +1372,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::bitwise_and</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::bitwise_and</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1399,8 +1401,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::bitwise_or</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::bitwise_or</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1428,8 +1430,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::bitwise_xor</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::bitwise_xor</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1457,8 +1459,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::comma</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::comma</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1481,8 +1483,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::mem_ptr</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::mem_ptr</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1510,8 +1512,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1539,8 +1541,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::shift_left_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::shift_left_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1568,8 +1570,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::shift_right_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::shift_right_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1597,8 +1599,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::multiplies_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::multiplies_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1626,8 +1628,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::divides_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::divides_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1655,8 +1657,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::modulus_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::modulus_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1684,8 +1686,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::plus_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::plus_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1713,8 +1715,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::minus_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::minus_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1742,8 +1744,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::bitwise_and_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::bitwise_and_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1771,8 +1773,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::bitwise_or_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::bitwise_or_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1800,8 +1802,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::bitwise_xor_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::bitwise_xor_assign</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1829,8 +1831,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::subscript</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::subscript</classname>, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -1858,8 +1860,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; <classname>proto::tag::function</classname>, <classname alt="proto::listN">proto::list<replaceable>N</replaceable></classname>&lt; A... &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; <classname>proto::tag::function</classname>, <classname alt="proto::listN">proto::list<replaceable>N</replaceable></classname>&lt; A... &gt; &gt;</type>
</typedef>
</struct>
@ -1922,8 +1924,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; Tag, <classname>proto::term</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; Tag, <classname>proto::term</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -1958,8 +1960,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; Tag, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; Tag, <classname alt="proto::listN">proto::list1</classname>&lt; T &gt; &gt;</type>
</typedef>
</struct>
@ -1994,8 +1996,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; Tag, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; Tag, <classname alt="proto::listN">proto::list2</classname>&lt; T, U &gt; &gt;</type>
</typedef>
</struct>
@ -2030,8 +2032,8 @@
<typedef name="type">
<type><classname>proto::expr</classname>&lt; Tag, <classname alt="proto::listN">proto::list<replaceable>N</replaceable></classname>&lt; A... &gt; &gt;</type>
</typedef>
<typedef name="proto_base_expr">
<type>type</type>
<typedef name="proto_grammar">
<type><classname>proto::basic_expr</classname>&lt; Tag, <classname alt="proto::listN">proto::list<replaceable>N</replaceable></classname>&lt; A... &gt; &gt;</type>
</typedef>
</struct>

View File

@ -55,8 +55,8 @@ struct CountLeaves :
</itemizedlist>
</description>
<inherit><type>PrimitiveTransform</type></inherit>
<typedef name="proto_base_expr">
<type>typename Grammar::proto_base_expr</type>
<typedef name="proto_grammar">
<type>typename Grammar::proto_grammar</type>
</typedef>
</struct>
@ -184,8 +184,8 @@ struct CountLeaves :
</method>
</method-group>
</struct>
<typedef name="proto_base_expr">
<type>typename Grammar::proto_base_expr</type>
<typedef name="proto_grammar">
<type>typename Grammar::proto_grammar</type>
</typedef>
</struct-specialization>

View File

@ -9,18 +9,16 @@
#ifndef BOOST_PROTO_DEBUG_HPP_EAN_12_31_2006
#define BOOST_PROTO_DEBUG_HPP_EAN_12_31_2006
#include <boost/preprocessor/iteration/local.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <iomanip>
#include <iostream>
#include <typeinfo>
#include <boost/preprocessor/stringize.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/proto/proto_fwd.hpp>
#include <boost/proto/expr.hpp>
#include <boost/proto/traits.hpp>
#include <boost/proto/matches.hpp>
#include <boost/proto/detail/dont_care.hpp>
#include <boost/proto/fusion.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
namespace boost { namespace proto
{
@ -111,6 +109,8 @@ namespace boost { namespace proto
/// purposes.
struct display_expr
{
BOOST_PROTO_CALLABLE()
typedef void result_type;
/// \param sout The \c ostream to which the expression tree
@ -126,48 +126,39 @@ namespace boost { namespace proto
/// \brief Pretty-print the current node in a Proto expression
/// tree.
template<typename Tag, typename Args>
void operator()(proto::expr<Tag, Args, 0> const &expr) const
template<typename Expr>
void operator()(Expr const &expr) const
{
using namespace hidden_detail_;
this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ")
<< Tag() << "(" << proto::value(expr) << ")\n";
this->first_ = false;
}
#define BOOST_PROTO_CHILD(Z, N, DATA) \
display(proto::child_c<N>(expr)); \
/**/
#define BOOST_PP_LOCAL_MACRO(N) \
/** \overload */ \
template<typename Tag, typename Args> \
void operator()(proto::expr<Tag, Args, N> const &expr) const \
{ \
using namespace hidden_detail_; \
this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ") \
<< Tag() << "(\n"; \
display_expr display(this->sout_, this->depth_ + 4); \
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, _) \
this->sout_ << std::setw(this->depth_) << "" << ")\n"; \
this->first_ = false; \
} \
/**/
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_PROTO_MAX_ARITY)
#include BOOST_PP_LOCAL_ITERATE()
#undef BOOST_PROTO_CHILD
/// \overload
///
template<typename T>
void operator()(T const &t) const
{
(*this)(t.proto_base());
this->impl(expr, mpl::long_<arity_of<Expr>::value>());
}
private:
display_expr(display_expr const &);
display_expr &operator =(display_expr const &);
template<typename Expr>
void impl(Expr const &expr, mpl::long_<0>) const
{
using namespace hidden_detail_;
typedef typename tag_of<Expr>::type tag;
this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ");
this->sout_ << tag() << "(" << proto::value(expr) << ")\n";
this->first_ = false;
}
template<typename Expr, typename Arity>
void impl(Expr const &expr, Arity) const
{
using namespace hidden_detail_;
typedef typename tag_of<Expr>::type tag;
this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ");
this->sout_ << tag() << "(\n";
display_expr display(this->sout_, this->depth_ + 4);
fusion::for_each(expr, display);
this->sout_ << std::setw(this->depth_) << "" << ")\n";
this->first_ = false;
}
int depth_;
mutable bool first_;
std::ostream &sout_;

View File

@ -56,6 +56,7 @@
#else
typedef BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)> proto_args;
#endif
typedef basic_expr<Tag, proto_args, BOOST_PP_ITERATION() > proto_grammar;
typedef default_domain proto_domain;
typedef default_generator proto_generator;
typedef proto::tag::proto_expr fusion_tag;

View File

@ -31,149 +31,148 @@ namespace boost { namespace proto
{};
}
namespace domainns_
/// \brief For use in defining domain tags to be used
/// with \c proto::extends\<\>. A \e Domain associates
/// an expression type with a \e Generator, and optionally
/// a \e Grammar.
///
/// The Generator determines how new expressions in the
/// domain are constructed. Typically, a generator wraps
/// all new expressions in a wrapper that imparts
/// domain-specific behaviors to expressions within its
/// domain. (See \c proto::extends\<\>.)
///
/// The Grammar determines whether a given expression is
/// valid within the domain, and automatically disables
/// any operator overloads which would cause an invalid
/// expression to be created. By default, the Grammar
/// parameter defaults to the wildcard, \c proto::_, which
/// makes all expressions valid within the domain.
///
/// The Super declares the domain currently being defined
/// to be a sub-domain of Super. Expressions in sub-domains
/// can be freely combined with expressions in its super-
/// domain (and <I>its</I> super-domain, etc.).
///
/// Example:
/// \code
/// template<typename Expr>
/// struct MyExpr;
///
/// struct MyGrammar
/// : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
/// {};
///
/// // Define MyDomain, in which all expressions are
/// // wrapped in MyExpr<> and only expressions that
/// // conform to MyGrammar are allowed.
/// struct MyDomain
/// : domain<generator<MyExpr>, MyGrammar>
/// {};
///
/// // Use MyDomain to define MyExpr
/// template<typename Expr>
/// struct MyExpr
/// : extends<Expr, MyExpr<Expr>, MyDomain>
/// {
/// // ...
/// };
/// \endcode
///
template<
typename Generator // = default_generator
, typename Grammar // = proto::_
, typename Super // = detail::not_a_domain
>
struct domain
: Generator
{
/// \brief For use in defining domain tags to be used
/// with \c proto::extends\<\>. A \e Domain associates
/// an expression type with a \e Generator, and optionally
/// a \e Grammar.
///
/// The Generator determines how new expressions in the
/// domain are constructed. Typically, a generator wraps
/// all new expressions in a wrapper that imparts
/// domain-specific behaviors to expressions within its
/// domain. (See \c proto::extends\<\>.)
///
/// The Grammar determines whether a given expression is
/// valid within the domain, and automatically disables
/// any operator overloads which would cause an invalid
/// expression to be created. By default, the Grammar
/// parameter defaults to the wildcard, \c proto::_, which
/// makes all expressions valid within the domain.
///
/// Example:
/// \code
/// template<typename Expr>
/// struct MyExpr;
///
/// struct MyGrammar
/// : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
/// {};
///
/// // Define MyDomain, in which all expressions are
/// // wrapped in MyExpr<> and only expressions that
/// // conform to MyGrammar are allowed.
/// struct MyDomain
/// : domain<generator<MyExpr>, MyGrammar>
/// {};
///
/// // Use MyDomain to define MyExpr
/// template<typename Expr>
/// struct MyExpr
/// : extends<Expr, MyExpr<Expr>, MyDomain>
/// {
/// // ...
/// };
/// \endcode
///
template<
typename Generator // = default_generator
, typename Grammar // = proto::_
, typename Super // = detail::not_a_domain
>
struct domain
: Generator
{
typedef Generator proto_generator;
typedef Grammar proto_grammar;
typedef Super proto_super_domain;
typedef Generator proto_generator;
typedef Grammar proto_grammar;
typedef Super proto_super_domain;
/// INTERNAL ONLY
typedef void proto_is_domain_;
};
/// INTERNAL ONLY
typedef void proto_is_domain_;
};
/// \brief The domain expressions have by default, if
/// \c proto::extends\<\> has not been used to associate
/// a domain with an expression.
///
struct default_domain
: domain<>
{};
/// \brief The domain expressions have by default, if
/// \c proto::extends\<\> has not been used to associate
/// a domain with an expression.
///
struct default_domain
: domain<>
{};
/// \brief A pseudo-domain for use in functions and
/// metafunctions that require a domain parameter. It
/// indicates that the domain of the parent node should
/// be inferred from the domains of the child nodes.
///
/// \attention \c deduce_domain is not itself a valid domain.
///
struct deduce_domain
: domain<detail::not_a_generator, detail::not_a_grammar, detail::not_a_domain>
{};
}
/// \brief A pseudo-domain for use in functions and
/// metafunctions that require a domain parameter. It
/// indicates that the domain of the parent node should
/// be inferred from the domains of the child nodes.
///
/// \attention \c deduce_domain is not itself a valid domain.
///
struct deduce_domain
: domain<detail::not_a_generator, detail::not_a_grammar, detail::not_a_domain>
{};
namespace result_of
/// A metafunction that returns \c mpl::true_
/// if the type \c T is the type of a Proto domain;
/// \c mpl::false_ otherwise. If \c T inherits from
/// \c proto::domain\<\>, \c is_domain\<T\> is
/// \c mpl::true_.
template<typename T, typename Void /* = void*/>
struct is_domain
: mpl::false_
{};
/// INTERNAL ONLY
///
template<typename T>
struct is_domain<T, typename T::proto_is_domain_>
: mpl::true_
{};
/// A metafunction that returns the domain of
/// a given type. If \c T is a Proto expression
/// type, it returns that expression's associated
/// domain. If not, it returns
/// \c proto::default_domain.
template<typename T, typename Void /* = void*/>
struct domain_of
{
/// A metafunction that returns \c mpl::true_
/// if the type \c T is the type of a Proto domain;
/// \c mpl::false_ otherwise. If \c T inherits from
/// \c proto::domain\<\>, \c is_domain\<T\> is
/// \c mpl::true_.
template<typename T, typename Void /* = void*/>
struct is_domain
: mpl::false_
{};
typedef default_domain type;
};
/// INTERNAL ONLY
///
template<typename T>
struct is_domain<T, typename T::proto_is_domain_>
: mpl::true_
{};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<T, typename T::proto_is_expr_>
{
typedef typename T::proto_domain type;
};
/// A metafunction that returns the domain of
/// a given type. If \c T is a Proto expression
/// type, it returns that expression's associated
/// domain. If not, it returns
/// \c proto::default_domain.
template<typename T, typename Void /* = void*/>
struct domain_of
{
typedef default_domain type;
};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<T &, void>
{
typedef typename domain_of<T>::type type;
};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<T, typename T::proto_is_expr_>
{
typedef typename T::proto_domain type;
};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<boost::reference_wrapper<T>, void>
{
typedef typename domain_of<T>::type type;
};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<T &, void>
{
typedef typename domain_of<T>::type type;
};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<boost::reference_wrapper<T>, void>
{
typedef typename domain_of<T>::type type;
};
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<boost::reference_wrapper<T> const, void>
{
typedef typename domain_of<T>::type type;
};
}
/// INTERNAL ONLY
///
template<typename T>
struct domain_of<boost::reference_wrapper<T> const, void>
{
typedef typename domain_of<T>::type type;
};
}}
#endif

View File

@ -165,6 +165,7 @@ namespace boost { namespace proto
typedef typename proto_base_expr::proto_tag proto_tag; \
typedef typename proto_base_expr::proto_args proto_args; \
typedef typename proto_base_expr::proto_arity proto_arity; \
typedef typename proto_base_expr::proto_grammar proto_grammar; \
typedef typename proto_base_expr::address_of_hack_type_ proto_address_of_hack_type_; \
typedef void proto_is_expr_; /**< INTERNAL ONLY */ \
BOOST_STATIC_CONSTANT(long, proto_arity_c = proto_base_expr::proto_arity_c); \
@ -576,20 +577,20 @@ namespace boost { namespace proto
template<typename This, typename Fun, typename Domain>
struct virtual_member
{
typedef
expr<tag::member, list2<This &, expr<tag::terminal, term<Fun> > const &>, 2>
proto_base_expr;
typedef Domain proto_domain;
typedef typename Domain::proto_generator proto_generator;
typedef virtual_member<This, Fun, Domain> proto_derived_expr;
typedef typename proto_base_expr::proto_tag proto_tag;
typedef typename proto_base_expr::proto_args proto_args;
typedef typename proto_base_expr::proto_arity proto_arity;
typedef typename proto_base_expr::address_of_hack_type_ proto_address_of_hack_type_;
typedef tag::member proto_tag;
typedef list2<This &, expr<tag::terminal, term<Fun> > const &> proto_args;
typedef mpl::long_<2> proto_arity;
typedef detail::not_a_valid_type proto_address_of_hack_type_;
typedef void proto_is_expr_; /**< INTERNAL ONLY */
BOOST_STATIC_CONSTANT(long, proto_arity_c = proto_base_expr::proto_arity_c);
BOOST_STATIC_CONSTANT(long, proto_arity_c = 2);
typedef boost::proto::tag::proto_expr fusion_tag;
BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_EXTENDS_CHILD, ~)
typedef This &proto_child0;
typedef expr<tag::terminal, term<Fun> > const &proto_child1;
typedef expr<proto_tag, proto_args, proto_arity_c> proto_base_expr;
typedef basic_expr<proto_tag, proto_args, proto_arity_c> proto_grammar;
typedef void proto_is_aggregate_; /**< INTERNAL ONLY */
BOOST_PROTO_EXTENDS_ASSIGN_()

View File

@ -73,241 +73,238 @@
}
namespace generatorns_
/// \brief A simple generator that passes an expression
/// through unchanged.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// The \c default_generator makes no modifications to the expressions
/// passed to it.
struct default_generator
{
/// \brief A simple generator that passes an expression
/// through unchanged.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// The \c default_generator makes no modifications to the expressions
/// passed to it.
struct default_generator
BOOST_PROTO_CALLABLE()
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr)>
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef Expr type;
};
/// \param expr A Proto expression
/// \return expr
template<typename Expr>
#ifdef BOOST_PROTO_STRICT_RESULT_OF
Expr
#else
Expr const &
#endif
operator ()(Expr const &e) const
{
return e;
}
typedef Expr type;
};
/// \brief A generator that wraps expressions passed
/// to it in the specified extension wrapper.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c generator\<\> wraps each expression passed to it in
/// the \c Extends\<\> wrapper.
template<template<typename> class Extends>
struct generator
/// \param expr A Proto expression
/// \return expr
template<typename Expr>
#ifdef BOOST_PROTO_STRICT_RESULT_OF
Expr
#else
Expr const &
#endif
operator ()(Expr const &e) const
{
BOOST_PROTO_CALLABLE()
return e;
}
};
template<typename Sig>
struct result;
/// \brief A generator that wraps expressions passed
/// to it in the specified extension wrapper.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c generator\<\> wraps each expression passed to it in
/// the \c Extends\<\> wrapper.
template<template<typename> class Extends>
struct generator
{
BOOST_PROTO_CALLABLE()
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef Extends<Expr> type;
};
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef Extends<Expr> type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef Extends<Expr> type;
};
/// \param expr A Proto expression
/// \return Extends<Expr>(expr)
template<typename Expr>
Extends<Expr> operator ()(Expr const &e) const
{
return Extends<Expr>(e);
}
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef Extends<Expr> type;
};
/// \brief A generator that wraps expressions passed
/// to it in the specified extension wrapper and uses
/// aggregate initialization for the wrapper.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c pod_generator\<\> wraps each expression passed to it in
/// the \c Extends\<\> wrapper, and uses aggregate initialzation
/// for the wrapped object.
template<template<typename> class Extends>
struct pod_generator
template<typename This, typename Expr>
struct result<This(Expr &)>
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef Extends<Expr> type;
};
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef Extends<Expr> type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef Extends<Expr> type;
};
/// \param expr The expression to wrap
/// \return <tt>Extends\<Expr\> that = {expr}; return that;</tt>
template<typename Expr>
Extends<Expr> operator ()(Expr const &e) const
{
Extends<Expr> that = {e};
return that;
}
typedef Extends<Expr> type;
};
/// \brief A generator that replaces child nodes held by
/// reference with ones held by value. Use with
/// \c compose_generators to forward that result to another
/// generator.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c by_value_generator ensures all child nodes are
/// held by value. This generator is typically composed with a
/// second generator for further processing, as
/// <tt>compose_generators\<by_value_generator, MyGenerator\></tt>.
struct by_value_generator
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef
typename detail::by_value_generator_<Expr>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef
typename detail::by_value_generator_<Expr>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef
typename detail::by_value_generator_<Expr>::type
type;
};
/// \param expr The expression to modify.
/// \return <tt>deep_copy(expr)</tt>
template<typename Expr>
typename result<by_value_generator(Expr)>::type operator ()(Expr const &e) const
{
return detail::by_value_generator_<Expr>::make(e);
}
typedef Extends<Expr> type;
};
/// \brief A composite generator that first applies one
/// transform to an expression and then forwards the result
/// on to another generator for further transformation.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c compose_generators\<\> is a composite generator that first
/// applies one transform to an expression and then forwards the
/// result on to another generator for further transformation.
template<typename First, typename Second>
struct compose_generators
/// \param expr A Proto expression
/// \return Extends<Expr>(expr)
template<typename Expr>
Extends<Expr> operator ()(Expr const &e) const
{
BOOST_PROTO_CALLABLE()
return Extends<Expr>(e);
}
};
template<typename Sig>
struct result;
/// \brief A generator that wraps expressions passed
/// to it in the specified extension wrapper and uses
/// aggregate initialization for the wrapper.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c pod_generator\<\> wraps each expression passed to it in
/// the \c Extends\<\> wrapper, and uses aggregate initialzation
/// for the wrapped object.
template<template<typename> class Extends>
struct pod_generator
{
BOOST_PROTO_CALLABLE()
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef
typename Second::template result<
Second(typename First::template result<First(Expr)>::type)
>::type
type;
};
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef
typename Second::template result<
Second(typename First::template result<First(Expr)>::type)
>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef
typename Second::template result<
Second(typename First::template result<First(Expr)>::type)
>::type
type;
};
/// \param expr The expression to modify.
/// \return Second()(First()(expr))
template<typename Expr>
typename result<compose_generators(Expr)>::type operator ()(Expr const &e) const
{
return Second()(First()(e));
}
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef Extends<Expr> type;
};
}
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef Extends<Expr> type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef Extends<Expr> type;
};
/// \param expr The expression to wrap
/// \return <tt>Extends\<Expr\> that = {expr}; return that;</tt>
template<typename Expr>
Extends<Expr> operator ()(Expr const &e) const
{
Extends<Expr> that = {e};
return that;
}
};
/// \brief A generator that replaces child nodes held by
/// reference with ones held by value. Use with
/// \c compose_generators to forward that result to another
/// generator.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c by_value_generator ensures all child nodes are
/// held by value. This generator is typically composed with a
/// second generator for further processing, as
/// <tt>compose_generators\<by_value_generator, MyGenerator\></tt>.
struct by_value_generator
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef
typename detail::by_value_generator_<Expr>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef
typename detail::by_value_generator_<Expr>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef
typename detail::by_value_generator_<Expr>::type
type;
};
/// \param expr The expression to modify.
/// \return <tt>deep_copy(expr)</tt>
template<typename Expr>
typename result<by_value_generator(Expr)>::type operator ()(Expr const &e) const
{
return detail::by_value_generator_<Expr>::make(e);
}
};
/// \brief A composite generator that first applies one
/// transform to an expression and then forwards the result
/// on to another generator for further transformation.
///
/// Generators are intended for use as the first template parameter
/// to the \c domain\<\> class template and control if and how
/// expressions within that domain are to be customized.
/// \c compose_generators\<\> is a composite generator that first
/// applies one transform to an expression and then forwards the
/// result on to another generator for further transformation.
template<typename First, typename Second>
struct compose_generators
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
struct result;
template<typename This, typename Expr>
struct result<This(Expr)>
{
typedef
typename Second::template result<
Second(typename First::template result<First(Expr)>::type)
>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr &)>
{
typedef
typename Second::template result<
Second(typename First::template result<First(Expr)>::type)
>::type
type;
};
template<typename This, typename Expr>
struct result<This(Expr const &)>
{
typedef
typename Second::template result<
Second(typename First::template result<First(Expr)>::type)
>::type
type;
};
/// \param expr The expression to modify.
/// \return Second()(First()(expr))
template<typename Expr>
typename result<compose_generators(Expr)>::type operator ()(Expr const &e) const
{
return Second()(First()(e));
}
};
/// INTERNAL ONLY
template<>

View File

@ -255,73 +255,6 @@
: make_expr_<tag::terminal, default_domain, A>
{};
template<typename Base, typename Expr>
Expr implicit_expr_wrap(Base const &e, mpl::false_, Expr *)
{
return Expr(e);
}
template<typename Base, typename Expr>
Expr implicit_expr_wrap(Base const &e, mpl::true_, Expr *)
{
Expr that = {e};
return that;
}
template<typename A0, typename Void = void>
struct implicit_expr_1
{
A0 &a0;
template<typename Args>
operator proto::expr<tag::terminal, Args, 0>() const
{
proto::expr<tag::terminal, Args, 0> that = {this->a0};
return that;
}
template<typename Expr>
operator Expr() const
{
typename Expr::proto_base_expr that = *this;
return detail::implicit_expr_wrap(that, is_aggregate<Expr>(), static_cast<Expr *>(0));
}
};
template<typename A0>
struct implicit_expr_1<A0, typename A0::proto_is_expr_>
{
A0 &a0;
#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(1010))
typedef typename remove_cv<A0>::type uncv_a0_type;
operator uncv_a0_type &() const
{
return const_cast<uncv_a0_type &>(this->a0);
}
#else
operator A0 &() const
{
return this->a0;
}
#endif
template<typename Tag, typename Args>
operator proto::expr<Tag, Args, 1>() const
{
proto::expr<Tag, Args, 1> that = {this->a0};
return that;
}
template<typename Expr>
operator Expr() const
{
typename Expr::proto_base_expr that = *this;
return detail::implicit_expr_wrap(that, is_aggregate<Expr>(), static_cast<Expr *>(0));
}
};
#define BOOST_PP_ITERATION_PARAMS_1 \
(4, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/make_expr.hpp>, 1)) \
/**/
@ -764,24 +697,6 @@
>::call(sequence2);
}
/// \brief Return a proxy object that holds its arguments by reference
/// and is implicitly convertible to an expression.
template<typename A0>
detail::implicit_expr_1<A0> const
implicit_expr(A0 &a0)
{
detail::implicit_expr_1<A0> that = {a0};
return that;
}
// Additional overloads generated by the preprocessor...
#define BOOST_PP_ITERATION_PARAMS_1 \
(4, (2, BOOST_PROTO_MAX_ARITY, <boost/proto/make_expr.hpp>, 4)) \
/**/
#include BOOST_PP_ITERATE()
/// INTERNAL ONLY
///
template<typename Tag, typename Domain>
@ -825,37 +740,6 @@
#define N BOOST_PP_ITERATION()
#define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
#if N > 1
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
struct BOOST_PP_CAT(implicit_expr_, N)
{
#define M0(Z, N, DATA) BOOST_PP_CAT(A, N) &BOOST_PP_CAT(a, N);
BOOST_PP_REPEAT(N, M0, ~)
#undef M0
template<typename Tag, typename Args>
operator proto::expr<Tag, Args, N>() const
{
#define M0(Z, N, DATA) \
implicit_expr_1<BOOST_PP_CAT(A, N)> BOOST_PP_CAT(b, N) \
= {this->BOOST_PP_CAT(a, N)}; \
typename Args::BOOST_PP_CAT(child, N) BOOST_PP_CAT(c, N) = BOOST_PP_CAT(b, N); \
/**/
BOOST_PP_REPEAT(N, M0, ~)
#undef M0
proto::expr<Tag, Args, N> that = {BOOST_PP_ENUM_PARAMS(N, c)};
return that;
}
template<typename Expr>
operator Expr() const
{
typename Expr::proto_base_expr that = *this;
return detail::implicit_expr_wrap(that, is_aggregate<Expr>(), static_cast<Expr *>(0));
}
};
#endif
template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
@ -1018,21 +902,4 @@
#undef N
#elif BOOST_PP_ITERATION_FLAGS() == 4
#define N BOOST_PP_ITERATION()
/// \overload
///
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)> const
implicit_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a))
{
detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)> that
= {BOOST_PP_ENUM_PARAMS(N, a)};
return that;
}
#undef N
#endif // BOOST_PP_IS_ITERATING

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,6 @@
#include <boost/utility/enable_if.hpp>
#include <boost/proto/proto_fwd.hpp>
#include <boost/proto/tags.hpp>
#include <boost/proto/expr.hpp>
#include <boost/proto/domain.hpp>
#include <boost/proto/matches.hpp>
#include <boost/proto/generate.hpp>
@ -43,7 +42,10 @@ namespace boost { namespace proto
template<typename Domain, typename Trait, typename Tag, typename Arg>
struct enable_unary<Domain, proto::_, Trait, Tag, Arg>
: boost::lazy_enable_if_c<Trait::value, result_of::make_expr<Tag, Domain, Arg &> >
: boost::lazy_enable_if_c<
Trait::value
, result_of::make_expr<Tag, Domain, Arg &>
>
{};
template<typename Trait, typename Tag, typename Arg>
@ -62,8 +64,8 @@ namespace boost { namespace proto
: boost::lazy_enable_if_c<
boost::mpl::and_<
Trait
, lazy_matches<proto::result_of::as_child<Left>, Grammar>
, lazy_matches<proto::result_of::as_child<Right>, Grammar>
, lazy_matches<result_of::as_child<Left>, Grammar>
, lazy_matches<result_of::as_child<Right>, Grammar>
, lazy_matches<result_of::make_expr<Tag, Domain, Left &, Right &>, Grammar>
>::value
, result_of::make_expr<Tag, Domain, Left &, Right &>
@ -72,7 +74,10 @@ namespace boost { namespace proto
template<typename Domain, typename Trait, typename Tag, typename Left, typename Right>
struct enable_binary<Domain, proto::_, Trait, Tag, Left, Right>
: boost::lazy_enable_if_c<Trait::value, result_of::make_expr<Tag, Domain, Left &, Right &> >
: boost::lazy_enable_if_c<
Trait::value
, result_of::make_expr<Tag, Domain, Left &, Right &>
>
{};
template<typename Trait, typename Tag, typename Left, typename Right>
@ -103,7 +108,7 @@ namespace boost { namespace proto
>::type const \
operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
{ \
return boost::proto::functional::make_expr<TAG, DOMAIN>::impl<Arg &>()(arg); \
return boost::proto::detail::make_expr_<TAG, DOMAIN, Arg &>()(arg); \
} \
\
template<typename Arg> \
@ -116,7 +121,7 @@ namespace boost { namespace proto
>::type const \
operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
{ \
return boost::proto::functional::make_expr<TAG, DOMAIN>::impl<Arg const &>()(arg); \
return boost::proto::detail::make_expr_<TAG, DOMAIN, Arg const &>()(arg); \
} \
/**/
@ -132,8 +137,7 @@ namespace boost { namespace proto
>::type const \
operator OP(Left &left, Right &right) \
{ \
return boost::proto::functional::make_expr<TAG, DOMAIN>:: \
impl<Left &, Right &>()(left, right); \
return boost::proto::detail::make_expr_<TAG, DOMAIN, Left &, Right &>()(left, right); \
} \
\
template<typename Left, typename Right> \
@ -147,8 +151,7 @@ namespace boost { namespace proto
>::type const \
operator OP(Left &left, Right const &right) \
{ \
return boost::proto::functional::make_expr<TAG, DOMAIN>:: \
impl<Left &, Right const &>()(left, right); \
return boost::proto::detail::make_expr_<TAG, DOMAIN, Left &, Right const &>()(left, right); \
} \
\
template<typename Left, typename Right> \
@ -162,8 +165,7 @@ namespace boost { namespace proto
>::type const \
operator OP(Left const &left, Right &right) \
{ \
return boost::proto::functional::make_expr<TAG, DOMAIN>:: \
impl<Left const &, Right &>()(left, right); \
return boost::proto::detail::make_expr_<TAG, DOMAIN, Left const &, Right &>()(left, right); \
} \
\
template<typename Left, typename Right> \
@ -177,8 +179,7 @@ namespace boost { namespace proto
>::type const \
operator OP(Left const &left, Right const &right) \
{ \
return boost::proto::functional::make_expr<TAG, DOMAIN>:: \
impl<Left const &, Right const &>()(left, right); \
return boost::proto::detail::make_expr_<TAG, DOMAIN, Left const &, Right const &>()(left, right);\
} \
/**/
@ -241,10 +242,22 @@ namespace boost { namespace proto
// if_else, for the non-overloadable ternary conditional operator ?:
template<typename A0, typename A1, typename A2>
typename result_of::make_expr<tag::if_else_, deduce_domain, A0 const &, A1 const &, A2 const &>::type const
typename result_of::make_expr<
tag::if_else_
, deduce_domain
, A0 const &
, A1 const &
, A2 const &
>::type const
if_else(A0 const &a0, A1 const &a1, A2 const &a2)
{
return functional::make_expr<tag::if_else_>::impl<A0 const &, A1 const &, A2 const &>()(a0, a1, a2);
return proto::detail::make_expr_<
tag::if_else_
, deduce_domain
, A0 const &
, A1 const &
, A2 const &
>()(a0, a1, a2);
}
}

View File

@ -92,6 +92,7 @@ namespace boost { namespace proto
struct dont_care;
struct undefined; // leave this undefined
struct not_a_valid_type;
struct private_type_
{
@ -243,61 +244,40 @@ namespace boost { namespace proto
}
////////////////////////////////////////////////////////////////////////////////////////////////
namespace wildcardns_
{
struct _;
}
////////////////////////////////////////////////////////////////////////////////////////////////
using wildcardns_::_;
struct _;
////////////////////////////////////////////////////////////////////////////////////////////////
namespace generatorns_
{
struct default_generator;
struct default_generator;
template<template<typename> class Extends>
struct generator;
template<template<typename> class Extends>
struct generator;
template<template<typename> class Extends>
struct pod_generator;
template<template<typename> class Extends>
struct pod_generator;
struct by_value_generator;
struct by_value_generator;
template<typename First, typename Second>
struct compose_generators;
}
////////////////////////////////////////////////////////////////////////////////////////////////
using generatorns_::default_generator;
using generatorns_::generator;
using generatorns_::pod_generator;
using generatorns_::by_value_generator;
using generatorns_::compose_generators;
template<typename First, typename Second>
struct compose_generators;
////////////////////////////////////////////////////////////////////////////////////////////////
namespace domainns_
{
template<
typename Generator = default_generator
, typename Grammar = proto::_
, typename Super = detail::not_a_domain
>
struct domain;
template<
typename Generator = default_generator
, typename Grammar = proto::_
, typename Super = detail::not_a_domain
>
struct domain;
struct default_domain;
struct default_domain;
struct deduce_domain;
}
////////////////////////////////////////////////////////////////////////////////////////////////
using domainns_::domain;
using domainns_::default_domain;
using domainns_::deduce_domain;
struct deduce_domain;
////////////////////////////////////////////////////////////////////////////////////////////////
namespace exprns_
{
template<typename Tag, typename Args, long Arity>
struct basic_expr;
template<typename Tag, typename Args, long Arity = Args::arity>
struct expr;
@ -317,47 +297,35 @@ namespace boost { namespace proto
////////////////////////////////////////////////////////////////////////////////////////////////
using exprns_::expr;
using exprns_::basic_expr;
using exprns_::extends;
using exprns_::is_proto_expr;
namespace control
{
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G, void)>
struct or_;
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G, void)>
struct or_;
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G, void)>
struct and_;
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G, void)>
struct and_;
template<typename Grammar>
struct not_;
template<typename Grammar>
struct not_;
template<typename Condition, typename Then = _, typename Else = not_<_> >
struct if_;
template<typename Condition, typename Then = _, typename Else = not_<_> >
struct if_;
template<typename Cases>
struct switch_;
template<typename Cases>
struct switch_;
template<typename T>
struct exact;
template<typename T>
struct exact;
template<typename T>
struct convertible_to;
template<typename T>
struct convertible_to;
template<typename Grammar>
struct vararg;
template<typename Grammar>
struct vararg;
int const N = INT_MAX;
}
using control::if_;
using control::or_;
using control::and_;
using control::not_;
using control::switch_;
using control::exact;
using control::convertible_to;
using control::vararg;
using control::N;
int const N = INT_MAX;
namespace context
{
@ -448,100 +416,89 @@ namespace boost { namespace proto
template<typename Tag, typename DomainOrSequence, typename SequenceOrVoid = void, typename Void = void>
struct unpack_expr;
template<typename T, typename Void = void>
struct is_expr;
template<typename T, typename Void = void>
struct is_domain;
template<typename Expr>
struct tag_of;
template<typename Expr>
struct arity_of;
template<typename T, typename Void = void>
struct domain_of;
template<typename Expr, typename Grammar>
struct matches;
}
using result_of::is_expr;
using result_of::is_domain;
using result_of::tag_of;
using result_of::arity_of;
using result_of::domain_of;
using result_of::matches;
template<typename T, typename Void = void>
struct is_expr;
namespace op
{
// Generic expression metafunctions and
// grammar elements
template<typename Tag, typename Arg>
struct unary_expr;
template<typename T, typename Void = void>
struct is_domain;
template<typename Tag, typename Left, typename Right>
struct binary_expr;
template<typename Expr>
struct tag_of;
template<typename Tag, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void)>
struct nary_expr;
template<typename Expr>
struct arity_of;
// Specific expression metafunctions and
// grammar elements, for convenience
template<typename T> struct terminal;
template<typename T> struct unary_plus;
template<typename T> struct negate;
template<typename T> struct dereference;
template<typename T> struct complement;
template<typename T> struct address_of;
template<typename T> struct logical_not;
template<typename T> struct pre_inc;
template<typename T> struct pre_dec;
template<typename T> struct post_inc;
template<typename T> struct post_dec;
template<typename T, typename Void = void>
struct domain_of;
template<typename T, typename U> struct shift_left;
template<typename T, typename U> struct shift_right;
template<typename T, typename U> struct multiplies;
template<typename T, typename U> struct divides;
template<typename T, typename U> struct modulus;
template<typename T, typename U> struct plus;
template<typename T, typename U> struct minus;
template<typename T, typename U> struct less;
template<typename T, typename U> struct greater;
template<typename T, typename U> struct less_equal;
template<typename T, typename U> struct greater_equal;
template<typename T, typename U> struct equal_to;
template<typename T, typename U> struct not_equal_to;
template<typename T, typename U> struct logical_or;
template<typename T, typename U> struct logical_and;
template<typename T, typename U> struct bitwise_and;
template<typename T, typename U> struct bitwise_or;
template<typename T, typename U> struct bitwise_xor;
template<typename T, typename U> struct comma;
template<typename T, typename U> struct mem_ptr;
template<typename Expr, typename Grammar>
struct matches;
template<typename T, typename U> struct assign;
template<typename T, typename U> struct shift_left_assign;
template<typename T, typename U> struct shift_right_assign;
template<typename T, typename U> struct multiplies_assign;
template<typename T, typename U> struct divides_assign;
template<typename T, typename U> struct modulus_assign;
template<typename T, typename U> struct plus_assign;
template<typename T, typename U> struct minus_assign;
template<typename T, typename U> struct bitwise_and_assign;
template<typename T, typename U> struct bitwise_or_assign;
template<typename T, typename U> struct bitwise_xor_assign;
template<typename T, typename U> struct subscript;
template<typename T, typename U> struct member;
template<typename T, typename U, typename V> struct if_else_;
// Generic expression metafunctions and
// grammar elements
template<typename Tag, typename Arg>
struct unary_expr;
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void)>
struct function;
}
template<typename Tag, typename Left, typename Right>
struct binary_expr;
using namespace op;
template<typename Tag, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void)>
struct nary_expr;
// Specific expression metafunctions and
// grammar elements, for convenience
template<typename T> struct terminal;
template<typename T> struct unary_plus;
template<typename T> struct negate;
template<typename T> struct dereference;
template<typename T> struct complement;
template<typename T> struct address_of;
template<typename T> struct logical_not;
template<typename T> struct pre_inc;
template<typename T> struct pre_dec;
template<typename T> struct post_inc;
template<typename T> struct post_dec;
template<typename T, typename U> struct shift_left;
template<typename T, typename U> struct shift_right;
template<typename T, typename U> struct multiplies;
template<typename T, typename U> struct divides;
template<typename T, typename U> struct modulus;
template<typename T, typename U> struct plus;
template<typename T, typename U> struct minus;
template<typename T, typename U> struct less;
template<typename T, typename U> struct greater;
template<typename T, typename U> struct less_equal;
template<typename T, typename U> struct greater_equal;
template<typename T, typename U> struct equal_to;
template<typename T, typename U> struct not_equal_to;
template<typename T, typename U> struct logical_or;
template<typename T, typename U> struct logical_and;
template<typename T, typename U> struct bitwise_and;
template<typename T, typename U> struct bitwise_or;
template<typename T, typename U> struct bitwise_xor;
template<typename T, typename U> struct comma;
template<typename T, typename U> struct mem_ptr;
template<typename T, typename U> struct assign;
template<typename T, typename U> struct shift_left_assign;
template<typename T, typename U> struct shift_right_assign;
template<typename T, typename U> struct multiplies_assign;
template<typename T, typename U> struct divides_assign;
template<typename T, typename U> struct modulus_assign;
template<typename T, typename U> struct plus_assign;
template<typename T, typename U> struct minus_assign;
template<typename T, typename U> struct bitwise_and_assign;
template<typename T, typename U> struct bitwise_or_assign;
template<typename T, typename U> struct bitwise_xor_assign;
template<typename T, typename U> struct subscript;
template<typename T, typename U> struct member;
template<typename T, typename U, typename V> struct if_else_;
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void)>
struct function;
namespace functional
{
@ -725,7 +682,8 @@ namespace boost { namespace proto
template<typename Sequence, typename State, typename Fun>
struct reverse_fold;
// BUGBUG can we replace fold_tree with fold<flatten(_), state, fun> ?
// Q: can we replace fold_tree with fold<flatten(_), state, fun> ?
// A: once segmented Fusion works well.
template<typename Sequence, typename State, typename Fun>
struct fold_tree;

View File

@ -65,12 +65,13 @@ BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::function)
BOOST_TYPEOF_REGISTER_TYPE(boost::proto::exprns_::is_proto_expr)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::exprns_::expr, (typename)(typename)(long))
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::exprns_::basic_expr, (typename)(typename)(long))
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::utility::literal, (typename)(typename))
BOOST_TYPEOF_REGISTER_TYPE(boost::proto::detail::not_a_generator)
BOOST_TYPEOF_REGISTER_TYPE(boost::proto::detail::not_a_grammar)
BOOST_TYPEOF_REGISTER_TYPE(boost::proto::detail::not_a_domain)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::domainns_::domain, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::domain, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::term, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::list1, 1)

View File

@ -162,67 +162,67 @@
: mpl::true_
{};
/// \brief A Boolean metafunction that indicates whether a given
/// type \c T is a Proto expression type.
///
/// If \c T has a nested type \c proto_is_expr_ that is a typedef
/// for \c void, <tt>is_expr\<T\>::::value</tt> is \c true. (Note, this
/// is the case for <tt>proto::expr\<\></tt>, any type that is derived
/// from <tt>proto::extends\<\></tt> or that uses the
/// <tt>BOOST_PROTO_BASIC_EXTENDS()</tt> macro.) Otherwise,
/// <tt>is_expr\<T\>::::value</tt> is \c false.
template<typename T, typename Void /* = void*/>
struct is_expr
: mpl::false_
{};
/// \brief A Boolean metafunction that indicates whether a given
/// type \c T is a Proto expression type.
///
/// If \c T has a nested type \c proto_is_expr_ that is a typedef
/// for \c void, <tt>is_expr\<T\>::::value</tt> is \c true. (Note, this
/// is the case for <tt>proto::expr\<\></tt>, any type that is derived
/// from <tt>proto::extends\<\></tt> or that uses the
/// <tt>BOOST_PROTO_BASIC_EXTENDS()</tt> macro.) Otherwise,
/// <tt>is_expr\<T\>::::value</tt> is \c false.
template<typename T>
struct is_expr<T, typename T::proto_is_expr_>
: mpl::true_
{};
template<typename T>
struct is_expr<T &, void>
: is_expr<T>
{};
/// \brief A metafunction that returns the tag type of a
/// Proto expression.
template<typename Expr>
struct tag_of
{
typedef typename Expr::proto_tag type;
};
template<typename Expr>
struct tag_of<Expr &>
{
typedef typename Expr::proto_tag type;
};
/// \brief A metafunction that returns the arity of a
/// Proto expression.
template<typename Expr>
struct arity_of
: Expr::proto_arity
{};
template<typename Expr>
struct arity_of<Expr &>
: Expr::proto_arity
{};
namespace result_of
{
/// \brief A Boolean metafunction that indicates whether a given
/// type \c T is a Proto expression type.
///
/// If \c T has a nested type \c proto_is_expr_ that is a typedef
/// for \c void, <tt>is_expr\<T\>::::value</tt> is \c true. (Note, this
/// is the case for <tt>proto::expr\<\></tt>, any type that is derived
/// from <tt>proto::extends\<\></tt> or that uses the
/// <tt>BOOST_PROTO_BASIC_EXTENDS()</tt> macro.) Otherwise,
/// <tt>is_expr\<T\>::::value</tt> is \c false.
template<typename T, typename Void /* = void*/>
struct is_expr
: mpl::false_
{};
/// \brief A Boolean metafunction that indicates whether a given
/// type \c T is a Proto expression type.
///
/// If \c T has a nested type \c proto_is_expr_ that is a typedef
/// for \c void, <tt>is_expr\<T\>::::value</tt> is \c true. (Note, this
/// is the case for <tt>proto::expr\<\></tt>, any type that is derived
/// from <tt>proto::extends\<\></tt> or that uses the
/// <tt>BOOST_PROTO_BASIC_EXTENDS()</tt> macro.) Otherwise,
/// <tt>is_expr\<T\>::::value</tt> is \c false.
template<typename T>
struct is_expr<T, typename T::proto_is_expr_>
: mpl::true_
{};
template<typename T>
struct is_expr<T &, void>
: is_expr<T>
{};
/// \brief A metafunction that returns the tag type of a
/// Proto expression.
template<typename Expr>
struct tag_of
{
typedef typename Expr::proto_tag type;
};
template<typename Expr>
struct tag_of<Expr &>
{
typedef typename Expr::proto_tag type;
};
/// \brief A metafunction that returns the arity of a
/// Proto expression.
template<typename Expr>
struct arity_of
: Expr::proto_arity
{};
template<typename Expr>
struct arity_of<Expr &>
: Expr::proto_arity
{};
/// \brief A metafunction that computes the return type of the \c as_expr()
/// function.
///
@ -528,258 +528,254 @@
} // namespace result_of
namespace op
/// \brief A metafunction for generating terminal expression types,
/// a grammar element for matching terminal expressions, and a
/// PrimitiveTransform that returns the current expression unchanged.
template<typename T>
struct terminal
: proto::transform<terminal<T>, int>
{
/// \brief A metafunction for generating terminal expression types,
/// a grammar element for matching terminal expressions, and a
/// PrimitiveTransform that returns the current expression unchanged.
template<typename T>
struct terminal
: proto::transform<terminal<T>, int>
{
typedef proto::expr<proto::tag::terminal, term<T>, 0> type;
typedef type proto_base_expr;
typedef proto::expr<proto::tag::terminal, term<T>, 0> type;
typedef proto::basic_expr<proto::tag::terminal, term<T>, 0> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl : transform_impl<Expr, State, Data>
template<typename Expr, typename State, typename Data>
struct impl : transform_impl<Expr, State, Data>
{
typedef Expr result_type;
/// \param e The current expression
/// \pre <tt>matches\<Expr, terminal\<T\> \>::::value</tt> is \c true.
/// \return \c e
/// \throw nothrow
#ifdef BOOST_PROTO_STRICT_RESULT_OF
result_type
#else
typename impl::expr_param
#endif
operator ()(
typename impl::expr_param e
, typename impl::state_param
, typename impl::data_param
) const
{
typedef Expr result_type;
/// \param e The current expression
/// \pre <tt>matches\<Expr, terminal\<T\> \>::::value</tt> is \c true.
/// \return \c e
/// \throw nothrow
#ifdef BOOST_PROTO_STRICT_RESULT_OF
result_type
#else
typename impl::expr_param
#endif
operator ()(
typename impl::expr_param e
, typename impl::state_param
, typename impl::data_param
) const
{
return e;
}
};
/// INTERNAL ONLY
typedef proto::tag::terminal proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
return e;
}
};
/// \brief A metafunction for generating ternary conditional expression types,
/// a grammar element for matching ternary conditional expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
template<typename T, typename U, typename V>
struct if_else_
: proto::transform<if_else_<T, U, V>, int>
/// INTERNAL ONLY
typedef proto::tag::terminal proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
};
/// \brief A metafunction for generating ternary conditional expression types,
/// a grammar element for matching ternary conditional expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
template<typename T, typename U, typename V>
struct if_else_
: proto::transform<if_else_<T, U, V>, int>
{
typedef proto::expr<proto::tag::if_else_, list3<T, U, V>, 3> type;
typedef proto::basic_expr<proto::tag::if_else_, list3<T, U, V>, 3> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<if_else_, Expr, State, Data>
{};
/// INTERNAL ONLY
typedef proto::tag::if_else_ proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
/// INTERNAL ONLY
typedef U proto_child1;
/// INTERNAL ONLY
typedef V proto_child2;
};
/// \brief A metafunction for generating nullary expression types with a
/// specified tag type,
/// a grammar element for matching nullary expressions, and a
/// PrimitiveTransform that returns the current expression unchanged.
///
/// Use <tt>nullary_expr\<_, _\></tt> as a grammar element to match any
/// nullary expression.
template<typename Tag, typename T>
struct nullary_expr
: proto::transform<nullary_expr<Tag, T>, int>
{
typedef proto::expr<Tag, term<T>, 0> type;
typedef proto::basic_expr<Tag, term<T>, 0> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl : transform_impl<Expr, State, Data>
{
typedef proto::expr<proto::tag::if_else_, list3<T, U, V>, 3> type;
typedef type proto_base_expr;
typedef Expr result_type;
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<if_else_, Expr, State, Data>
{};
/// INTERNAL ONLY
typedef proto::tag::if_else_ proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
/// INTERNAL ONLY
typedef U proto_child1;
/// INTERNAL ONLY
typedef V proto_child2;
};
/// \brief A metafunction for generating nullary expression types with a
/// specified tag type,
/// a grammar element for matching nullary expressions, and a
/// PrimitiveTransform that returns the current expression unchanged.
///
/// Use <tt>nullary_expr\<_, _\></tt> as a grammar element to match any
/// nullary expression.
template<typename Tag, typename T>
struct nullary_expr
: proto::transform<nullary_expr<Tag, T>, int>
{
typedef proto::expr<Tag, term<T>, 0> type;
typedef type proto_base_expr;
template<typename Expr, typename State, typename Data>
struct impl : transform_impl<Expr, State, Data>
/// \param e The current expression
/// \pre <tt>matches\<Expr, nullary_expr\<Tag, T\> \>::::value</tt> is \c true.
/// \return \c e
/// \throw nothrow
#ifdef BOOST_PROTO_STRICT_RESULT_OF
result_type
#else
typename impl::expr_param
#endif
operator ()(
typename impl::expr_param e
, typename impl::state_param
, typename impl::data_param
) const
{
typedef Expr result_type;
/// \param e The current expression
/// \pre <tt>matches\<Expr, nullary_expr\<Tag, T\> \>::::value</tt> is \c true.
/// \return \c e
/// \throw nothrow
#ifdef BOOST_PROTO_STRICT_RESULT_OF
result_type
#else
typename impl::expr_param
#endif
operator ()(
typename impl::expr_param e
, typename impl::state_param
, typename impl::data_param
) const
{
return e;
}
};
/// INTERNAL ONLY
typedef Tag proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
return e;
}
};
/// \brief A metafunction for generating unary expression types with a
/// specified tag type,
/// a grammar element for matching unary expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
///
/// Use <tt>unary_expr\<_, _\></tt> as a grammar element to match any
/// unary expression.
template<typename Tag, typename T>
struct unary_expr
: proto::transform<unary_expr<Tag, T>, int>
{
typedef proto::expr<Tag, list1<T>, 1> type;
typedef type proto_base_expr;
/// INTERNAL ONLY
typedef Tag proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
};
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<unary_expr, Expr, State, Data>
{};
/// \brief A metafunction for generating unary expression types with a
/// specified tag type,
/// a grammar element for matching unary expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
///
/// Use <tt>unary_expr\<_, _\></tt> as a grammar element to match any
/// unary expression.
template<typename Tag, typename T>
struct unary_expr
: proto::transform<unary_expr<Tag, T>, int>
{
typedef proto::expr<Tag, list1<T>, 1> type;
typedef proto::basic_expr<Tag, list1<T>, 1> proto_grammar;
/// INTERNAL ONLY
typedef Tag proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
};
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<unary_expr, Expr, State, Data>
{};
/// \brief A metafunction for generating binary expression types with a
/// specified tag type,
/// a grammar element for matching binary expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
///
/// Use <tt>binary_expr\<_, _, _\></tt> as a grammar element to match any
/// binary expression.
template<typename Tag, typename T, typename U>
struct binary_expr
: proto::transform<binary_expr<Tag, T, U>, int>
{
typedef proto::expr<Tag, list2<T, U>, 2> type;
typedef type proto_base_expr;
/// INTERNAL ONLY
typedef Tag proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
};
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<binary_expr, Expr, State, Data>
{};
/// \brief A metafunction for generating binary expression types with a
/// specified tag type,
/// a grammar element for matching binary expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
///
/// Use <tt>binary_expr\<_, _, _\></tt> as a grammar element to match any
/// binary expression.
template<typename Tag, typename T, typename U>
struct binary_expr
: proto::transform<binary_expr<Tag, T, U>, int>
{
typedef proto::expr<Tag, list2<T, U>, 2> type;
typedef proto::basic_expr<Tag, list2<T, U>, 2> proto_grammar;
/// INTERNAL ONLY
typedef Tag proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
/// INTERNAL ONLY
typedef U proto_child1;
};
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<binary_expr, Expr, State, Data>
{};
#define BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(Op) \
template<typename T> \
struct Op \
: proto::transform<Op<T>, int> \
{ \
typedef proto::expr<proto::tag::Op, list1<T>, 1> type; \
typedef type proto_base_expr; \
/// INTERNAL ONLY
typedef Tag proto_tag;
/// INTERNAL ONLY
typedef T proto_child0;
/// INTERNAL ONLY
typedef U proto_child1;
};
#define BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(Op) \
template<typename T> \
struct Op \
: proto::transform<Op<T>, int> \
{ \
typedef proto::expr<proto::tag::Op, list1<T>, 1> type; \
typedef proto::basic_expr<proto::tag::Op, list1<T>, 1> proto_grammar; \
\
template<typename Expr, typename State, typename Data> \
struct impl \
: detail::pass_through_impl<Op, Expr, State, Data> \
{}; \
template<typename Expr, typename State, typename Data> \
struct impl \
: detail::pass_through_impl<Op, Expr, State, Data> \
{}; \
\
typedef proto::tag::Op proto_tag; \
typedef T proto_child0; \
}; \
/**/
typedef proto::tag::Op proto_tag; \
typedef T proto_child0; \
}; \
/**/
#define BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(Op) \
template<typename T, typename U> \
struct Op \
: proto::transform<Op<T, U>, int> \
{ \
typedef proto::expr<proto::tag::Op, list2<T, U>, 2> type; \
typedef type proto_base_expr; \
#define BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(Op) \
template<typename T, typename U> \
struct Op \
: proto::transform<Op<T, U>, int> \
{ \
typedef proto::expr<proto::tag::Op, list2<T, U>, 2> type; \
typedef proto::basic_expr<proto::tag::Op, list2<T, U>, 2> proto_grammar; \
\
template<typename Expr, typename State, typename Data> \
struct impl \
: detail::pass_through_impl<Op, Expr, State, Data> \
{}; \
template<typename Expr, typename State, typename Data> \
struct impl \
: detail::pass_through_impl<Op, Expr, State, Data> \
{}; \
\
typedef proto::tag::Op proto_tag; \
typedef T proto_child0; \
typedef U proto_child1; \
}; \
/**/
typedef proto::tag::Op proto_tag; \
typedef T proto_child0; \
typedef U proto_child1; \
}; \
/**/
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(unary_plus)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(negate)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(dereference)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(complement)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(address_of)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(logical_not)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(pre_inc)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(pre_dec)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(post_inc)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(post_dec)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(unary_plus)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(negate)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(dereference)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(complement)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(address_of)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(logical_not)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(pre_inc)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(pre_dec)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(post_inc)
BOOST_PROTO_DEFINE_UNARY_METAFUNCTION(post_dec)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_left)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_right)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(multiplies)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(divides)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(modulus)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(plus)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(minus)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(less)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(greater)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(less_equal)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(greater_equal)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(equal_to)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(not_equal_to)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(logical_or)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(logical_and)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_or)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_and)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_xor)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(comma)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(mem_ptr)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_left_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_right_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(multiplies_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(divides_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(modulus_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(plus_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(minus_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_or_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_and_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_xor_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(subscript)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(member)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_left)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_right)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(multiplies)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(divides)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(modulus)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(plus)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(minus)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(less)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(greater)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(less_equal)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(greater_equal)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(equal_to)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(not_equal_to)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(logical_or)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(logical_and)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_or)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_and)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_xor)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(comma)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(mem_ptr)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_left_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(shift_right_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(multiplies_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(divides_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(modulus_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(plus_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(minus_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_or_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_and_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(bitwise_xor_assign)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(subscript)
BOOST_PROTO_DEFINE_BINARY_METAFUNCTION(member)
#undef BOOST_PROTO_DEFINE_UNARY_METAFUNCTION
#undef BOOST_PROTO_DEFINE_BINARY_METAFUNCTION
} // namespace op
#undef BOOST_PROTO_DEFINE_UNARY_METAFUNCTION
#undef BOOST_PROTO_DEFINE_BINARY_METAFUNCTION
#define BOOST_PROTO_CHILD(Z, N, DATA) \
/** INTERNAL ONLY */ \
@ -806,10 +802,13 @@
template<typename This, typename T>
struct result<This(T)>
{
typedef typename remove_reference<T>::type unref_type;
typedef typename result_of::as_expr<unref_type, Domain>::type type;
};
: result_of::as_expr<T, Domain>
{};
template<typename This, typename T>
struct result<This(T &)>
: result_of::as_expr<T, Domain>
{};
/// \brief Wrap an object in a Proto terminal if it isn't a
/// Proto expression already.
@ -860,10 +859,13 @@
template<typename This, typename T>
struct result<This(T)>
{
typedef typename remove_reference<T>::type unref_type;
typedef typename result_of::as_child<unref_type, Domain>::type type;
};
: result_of::as_child<T, Domain>
{};
template<typename This, typename T>
struct result<This(T &)>
: result_of::as_child<T, Domain>
{};
/// \brief Wrap an object in a Proto terminal if it isn't a
/// Proto expression already.
@ -1384,93 +1386,89 @@
#define N BOOST_PP_ITERATION()
#if N > 0
namespace op
/// \brief A metafunction for generating function-call expression types,
/// a grammar element for matching function-call expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
struct function
#if N != BOOST_PROTO_MAX_ARITY
<
BOOST_PP_ENUM_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
#endif
: proto::transform<
function<
BOOST_PP_ENUM_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
, int
>
{
/// \brief A metafunction for generating function-call expression types,
/// a grammar element for matching function-call expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
struct function
#if N != BOOST_PROTO_MAX_ARITY
<
BOOST_PP_ENUM_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
#endif
: proto::transform<
function<
BOOST_PP_ENUM_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
, int
typedef proto::expr<proto::tag::function, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> type;
typedef proto::basic_expr<proto::tag::function, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<function, Expr, State, Data>
{};
/// INTERNAL ONLY
typedef proto::tag::function proto_tag;
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, A)
BOOST_PP_REPEAT_FROM_TO(
N
, BOOST_PROTO_MAX_ARITY
, BOOST_PROTO_CHILD
, detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
)
};
/// \brief A metafunction for generating n-ary expression types with a
/// specified tag type,
/// a grammar element for matching n-ary expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
///
/// Use <tt>nary_expr\<_, vararg\<_\> \></tt> as a grammar element to match any
/// n-ary expression; that is, any non-terminal.
template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct nary_expr
#if N != BOOST_PROTO_MAX_ARITY
<
Tag
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
#endif
: proto::transform<
nary_expr<
Tag
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
{
typedef proto::expr<proto::tag::function, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> type;
typedef type proto_base_expr;
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<function, Expr, State, Data>
{};
/// INTERNAL ONLY
typedef proto::tag::function proto_tag;
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, A)
BOOST_PP_REPEAT_FROM_TO(
N
, BOOST_PROTO_MAX_ARITY
, BOOST_PROTO_CHILD
, detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
)
};
/// \brief A metafunction for generating n-ary expression types with a
/// specified tag type,
/// a grammar element for matching n-ary expressions, and a
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
/// transform.
///
/// Use <tt>nary_expr\<_, vararg\<_\> \></tt> as a grammar element to match any
/// n-ary expression; that is, any non-terminal.
template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct nary_expr
#if N != BOOST_PROTO_MAX_ARITY
<
Tag
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
, int
>
#endif
: proto::transform<
nary_expr<
Tag
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
>
, int
>
{
typedef proto::expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> type;
typedef type proto_base_expr;
{
typedef proto::expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> type;
typedef proto::basic_expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<nary_expr, Expr, State, Data>
{};
template<typename Expr, typename State, typename Data>
struct impl
: detail::pass_through_impl<nary_expr, Expr, State, Data>
{};
/// INTERNAL ONLY
typedef Tag proto_tag;
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, A)
BOOST_PP_REPEAT_FROM_TO(
N
, BOOST_PROTO_MAX_ARITY
, BOOST_PROTO_CHILD
, detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
)
};
} // namespace op
/// INTERNAL ONLY
typedef Tag proto_tag;
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, A)
BOOST_PP_REPEAT_FROM_TO(
N
, BOOST_PROTO_MAX_ARITY
, BOOST_PROTO_CHILD
, detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
)
};
namespace detail
{

View File

@ -55,7 +55,7 @@
struct when
: PrimitiveTransform
{
typedef typename Grammar::proto_base_expr proto_base_expr;
typedef typename Grammar::proto_grammar proto_grammar;
};
/// \brief A specialization that treats function pointer Transforms as
@ -138,7 +138,7 @@
struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))>
: transform<when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))> >
{
typedef typename Grammar::proto_base_expr proto_base_expr;
typedef typename Grammar::proto_grammar proto_grammar;
// Note: do not evaluate is_callable<R> in this scope.
// R may be an incomplete type at this point.