• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" ?>
2<!--
3  Copyright 2010 Eric Niebler
4
5  Distributed under the Boost
6  Software License, Version 1.0. (See accompanying
7  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8  -->
9<concept name="Expr" category="utility">
10  <param name="Expr" role="expession-type"/>
11  <param name="Tag" role="tag-type"/>
12  <param name="Domain" role="domain-type"/>
13  <param name="N" role="mpl-integral-constant-type"/>
14
15  <models-sentence>
16    The type <arg num="1"/> must be a model of <self/>.
17  </models-sentence>
18
19  <models-sentence>
20    The type <arg num="3"/> must be a model of <conceptname>Domain</conceptname>.
21  </models-sentence>
22
23  <models-sentence>
24    The type <arg num="4"/> must be a model of MPL Integral Constant.
25  </models-sentence>
26
27  <description>
28    <para>
29      An Expr represents a tagged node in an expression tree.
30      The children of the Expr must themselves satisfy the
31      Expr concept. The Expr has an arity representing the
32      number of children. If the number of children is zero,
33      the Expr also has a value. An Expr also has an associated
34      <conceptname>Domain</conceptname>.
35    </para>
36  </description>
37
38  <notation variables="e">
39    <sample-value>
40      <type name="Expr"/>
41    </sample-value>
42  </notation>
43
44  <associated-type name="proto_tag">
45    <get-member-type name="proto_tag">
46      <type name="Expr"/>
47    </get-member-type>
48    <description>
49      <simpara>The tag type of the Expr.</simpara>
50    </description>
51  </associated-type>
52
53  <associated-type name="proto_args">
54    <get-member-type name="proto_args">
55      <type name="Expr"/>
56    </get-member-type>
57    <description>
58      <simpara>A typelist representing either the types of the child nodes, or,
59        if the arity of the Expr is 0, of the value of the terminal.</simpara>
60    </description>
61  </associated-type>
62
63  <associated-type name="proto_arity">
64    <get-member-type name="proto_arity">
65      <type name="Expr"/>
66    </get-member-type>
67    <description>
68      <simpara>
69        The arity (number of child nodes) of the Expr.
70        <computeroutput>proto_arity</computeroutput> is an MPL Integral Constant.
71      </simpara>
72    </description>
73  </associated-type>
74
75  <associated-type name="proto_grammar">
76    <get-member-type name="proto_grammar">
77      <type name="Expr"/>
78    </get-member-type>
79    <description>
80      <simpara>
81        A typedef for an instantiation of
82        <classname alt="boost::proto::basic_expr">
83          <code>proto::basic_expr&lt;&gt;</code>
84        </classname>
85        that is equivalent to Expr. Expression types are equivalent if they have the
86        same <code>proto_tag</code>, <code>proto_args</code>, and <code>proto_arity</code>.
87      </simpara>
88    </description>
89  </associated-type>
90
91  <associated-type name="proto_base_expr">
92    <get-member-type name="proto_base_expr">
93      <type name="Expr"/>
94    </get-member-type>
95    <description>
96      <simpara>
97        A typedef for an instantiation of
98        <classname alt="boost::proto::expr"><code>proto::expr&lt;&gt;</code></classname> or
99        <classname alt="boost::proto::basic_expr"><code>proto::basic_expr&lt;&gt;</code></classname>
100        that is equivalent to Expr. Expression types are equivalent if they have the
101        same <code>proto_tag</code>, <code>proto_args</code>, and <code>proto_arity</code>.
102      </simpara>
103    </description>
104  </associated-type>
105
106  <associated-type name="proto_derived_expr">
107    <get-member-type name="proto_derived_expr">
108      <type name="Expr"/>
109    </get-member-type>
110    <description>
111      <simpara>
112        A typedef for <code>Expr</code>.
113      </simpara>
114    </description>
115  </associated-type>
116
117  <associated-type name="proto_domain">
118    <get-member-type name="proto_domain">
119      <type name="Expr"/>
120    </get-member-type>
121    <description>
122      <simpara>
123        The Domain of the Expr. <computeroutput>proto_domain</computeroutput>
124        models <conceptname>Domain</conceptname>.
125      </simpara>
126    </description>
127  </associated-type>
128
129  <associated-type name="proto_childN">
130    <get-member-type name="proto_childN">
131      <type name="Expr"/>
132    </get-member-type>
133    <description>
134      <simpara>The type of the Nth child of Expr. Requires
135        <code>0 == N::value || N::value &lt; proto_arity::value</code></simpara>
136    </description>
137  </associated-type>
138
139  <valid-expression name="Get N-th Child">
140    <apply-function name="boost::proto::child&lt; N &gt;">
141      <sample-value>
142        <type name="Expr"/>
143      </sample-value>
144    </apply-function>
145    <return-type>
146      <require-same-type testable="yes">
147        <type name="proto_childN"/>
148      </require-same-type>
149    </return-type>
150    <semantics>Extracts the Nth child from this Expr.
151      Requires <computeroutput>N::value &lt; proto_arity::value</computeroutput>.</semantics>
152  </valid-expression>
153
154  <valid-expression name="Get Terminal Value">
155    <apply-function name="boost::proto::value">
156      <sample-value>
157        <type name="Expr"/>
158      </sample-value>
159    </apply-function>
160    <return-type>
161      <require-same-type testable="yes">
162        <type name="proto_child0"/>
163      </require-same-type>
164    </return-type>
165    <semantics>
166      Extracts the value from a terminal Expr.
167      Requires <computeroutput>0 == proto_arity::value</computeroutput>.
168    </semantics>
169  </valid-expression>
170
171  <valid-expression name="Get Base">
172    <apply-method name="proto_base">
173      <sample-value>
174        <type name="Expr"/>
175      </sample-value>
176    </apply-method>
177    <return-type>
178      <require-same-type testable="yes">
179        <type name="proto_base_expr"/>
180      </require-same-type>
181    </return-type>
182    <semantics>
183        Returns an object of type
184        <classname alt="boost::proto::expr"><code>proto::expr&lt;&gt;</code></classname> or
185        <classname alt="boost::proto::basic_expr"><code>proto::basic_expr&lt;&gt;</code></classname>
186        that is equivalent to <code>e</code>.
187    </semantics>
188  </valid-expression>
189
190  <example-model>
191    <type name="boost::proto::literal&lt; int &gt;"/>
192  </example-model>
193
194</concept>
195