default.xml 10 KB

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