1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
|
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2012 Eric Niebler
Distributed under the Boost
Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-->
<header name="boost/proto/transform/default.hpp">
<namespace name="boost">
<namespace name="proto">
<struct name="_default">
<template>
<template-type-parameter name="Grammar">
<default><replaceable>unspecified</replaceable></default>
</template-type-parameter>
</template>
<inherit><classname>proto::transform</classname>< _default<Grammar> ></inherit>
<purpose>A <conceptname>PrimitiveTransform</conceptname> that gives expressions their
usual C++ behavior</purpose>
<description>
<para>
For the complete description of the behavior of the <computeroutput>proto::_default</computeroutput>
transform, see the documentation for the nested <computeroutput>
<classname>proto::_default::impl<></classname>
</computeroutput> class template.
</para>
<para>
When used without specifying a <computeroutput>Grammar</computeroutput> parameter,
<computeroutput>proto::_default</computeroutput> behaves as if the parameter were
<computeroutput>proto::_default<></computeroutput>.
</para>
</description>
<struct name="impl">
<template>
<template-type-parameter name="Expr"/>
<template-type-parameter name="State"/>
<template-type-parameter name="Data"/>
</template>
<inherit><type><classname>proto::transform_impl</classname><Expr, State, Data></type></inherit>
<typedef name="Tag">
<purpose>For exposition only</purpose>
<type>typename Expr::tag_type</type>
</typedef>
<data-member name="s_expr" specifiers="static">
<purpose>For exposition only</purpose>
<type>Expr</type>
</data-member>
<data-member name="s_state" specifiers="static">
<purpose>For exposition only</purpose>
<type>State</type>
</data-member>
<data-member name="s_data" specifiers="static">
<purpose>For exposition only</purpose>
<type>Data</type>
</data-member>
<typedef name="result_type">
<type><emphasis>see-below</emphasis></type>
<description>
<itemizedlist>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> corresponds to a unary prefix operator,
then the result type is
<programlisting>decltype(
OP Grammar()(<functionname>proto::child</functionname>(s_expr), s_state, s_data)
)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> corresponds to a unary postfix operator,
then the result type is
<programlisting>decltype(
Grammar()(<functionname>proto::child</functionname>(s_expr), s_state, s_data) OP
)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> corresponds to a binary infix operator,
then the result type is
<programlisting>decltype(
Grammar()(<functionname>proto::left</functionname>(s_expr), s_state, s_data) OP
Grammar()(<functionname>proto::right</functionname>(s_expr), s_state, s_data)
)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::subscript</classname>
</computeroutput>,
then the result type is
<programlisting>decltype(
Grammar()(<functionname>proto::left</functionname>(s_expr), s_state, s_data) [
Grammar()(<functionname>proto::right</functionname>(s_expr), s_state, s_data) ]
)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::if_else_</classname>
</computeroutput>,
then the result type is
<programlisting>decltype(
Grammar()(<functionname>proto::child_c</functionname><0>(s_expr), s_state, s_data) ?
Grammar()(<functionname>proto::child_c</functionname><1>(s_expr), s_state, s_data) :
Grammar()(<functionname>proto::child_c</functionname><2>(s_expr), s_state, s_data)
)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::function</classname>
</computeroutput>,
then the result type is
<programlisting>decltype(
Grammar()(<functionname>proto::child_c</functionname><0>(s_expr), s_state, s_data) (
Grammar()(<functionname>proto::child_c</functionname><1>(s_expr), s_state, s_data),
...
Grammar()(<functionname>proto::child_c</functionname><N>(s_expr), s_state, s_data) )
)</programlisting>
</para>
</listitem>
</itemizedlist>
</description>
</typedef>
<description>
<para>
Let <computeroutput><computeroutput>OP</computeroutput></computeroutput> be the C++ operator
corresponding to <computeroutput>Expr::proto_tag</computeroutput>. (For example, if
<computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::plus</classname></computeroutput>, let <computeroutput>
<computeroutput>OP</computeroutput></computeroutput> be <computeroutput>+</computeroutput>.)
</para>
</description>
<method-group name="public member functions">
<method name="operator()" cv="const">
<type>result_type</type>
<parameter name="expr">
<paramtype>typename impl::expr_param</paramtype>
</parameter>
<parameter name="state">
<paramtype>typename impl::state_param</paramtype>
</parameter>
<parameter name="data">
<paramtype>typename impl::data_param</paramtype>
</parameter>
<description>
<computeroutput>
<classname>proto::_default</classname><Grammar>::impl<Expr, State, Data>::operator()
</computeroutput> returns the following:
<itemizedlist>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> corresponds to a unary prefix operator,
then return
<programlisting>OP Grammar()(<functionname>proto::child</functionname>(expr), state, data)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> corresponds to a unary postfix operator,
then return
<programlisting>Grammar()(<functionname>proto::child</functionname>(expr), state, data) OP</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> corresponds to a binary infix operator,
then return
<programlisting>Grammar()(<functionname>proto::left</functionname>(expr), state, data) OP
Grammar()(<functionname>proto::right</functionname>(expr), state, data)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::subscript</classname>
</computeroutput>,
then return
<programlisting>Grammar()(<functionname>proto::left</functionname>(expr), state, data) [
Grammar()(<functionname>proto::right</functionname>(expr), state, data) ]</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::if_else_</classname>
</computeroutput>,
then return
<programlisting>Grammar()(<functionname>proto::child_c</functionname><0>(expr), state, data) ?
Grammar()(<functionname>proto::child_c</functionname><1>(expr), state, data) :
Grammar()(<functionname>proto::child_c</functionname><2>(expr), state, data)</programlisting>
</para>
</listitem>
<listitem>
<para>
If <computeroutput>Tag</computeroutput> is <computeroutput>
<classname>proto::tag::function</classname>
</computeroutput>,
then return
<programlisting>Grammar()(<functionname>proto::child_c</functionname><0>(expr), state, data) (
Grammar()(<functionname>proto::child_c</functionname><1>(expr), state, data),
...
Grammar()(<functionname>proto::child_c</functionname><N>(expr), state, data) )</programlisting>
</para>
</listitem>
</itemizedlist>
</description>
</method>
</method-group>
<description>
<para>
The behavior of this class is specified in terms of the C++0x <computeroutput>decltype</computeroutput>
keyword. In systems where this keyword is not available, Proto uses the Boost.Typeof library to
approximate the behavior.
</para>
</description>
</struct>
</struct>
</namespace>
</namespace>
</header>
|