lazy.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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/lazy.hpp">
  9. <para>
  10. Contains definition of the
  11. <computeroutput>
  12. <classname alt="boost::proto::lazy">proto::lazy&lt;&gt;</classname>
  13. </computeroutput> transform.
  14. </para>
  15. <namespace name="boost">
  16. <namespace name="proto">
  17. <struct name="lazy">
  18. <template>
  19. <template-type-parameter name="T"/>
  20. </template>
  21. <inherit><classname>proto::transform</classname>&lt; lazy&lt;T&gt; &gt;</inherit>
  22. <purpose>A <conceptname>PrimitiveTransform</conceptname> that uses
  23. <computeroutput><classname>proto::make&lt;&gt;</classname></computeroutput> to build a
  24. <conceptname>CallableTransform</conceptname>, and then uses
  25. <computeroutput><classname>proto::call&lt;&gt;</classname></computeroutput> to apply it.
  26. </purpose>
  27. <description>
  28. <para>
  29. <computeroutput>proto::lazy&lt;&gt;</computeroutput> is useful as a higher-order transform,
  30. when the transform to be applied depends on the current state of the transformation. The
  31. invocation of the <computeroutput>
  32. <classname>proto::make&lt;&gt;</classname>
  33. </computeroutput> transform evaluates any nested transforms, and the resulting type is treated
  34. as a <conceptname>CallableTransform</conceptname>, which is evaluated with
  35. <computeroutput><classname>proto::call&lt;&gt;</classname></computeroutput>.
  36. </para>
  37. <para>
  38. For the full description of the behavior of the
  39. <computeroutput>
  40. <classname>proto::lazy&lt;&gt;</classname>
  41. </computeroutput>
  42. transform, see the documentation for the nested
  43. <computeroutput>
  44. <classname>proto::lazy::impl&lt;&gt;</classname>
  45. </computeroutput>
  46. class template.
  47. </para>
  48. </description>
  49. <struct name="impl">
  50. <template>
  51. <template-type-parameter name="Expr"/>
  52. <template-type-parameter name="State"/>
  53. <template-type-parameter name="Data"/>
  54. </template>
  55. <inherit><type><classname>proto::transform_impl</classname>&lt;Expr, State, Data&gt;</type></inherit>
  56. <typedef name="result_type">
  57. <type><replaceable>see-below</replaceable></type>
  58. <description>
  59. <para>
  60. <computeroutput><classname>proto::lazy</classname>&lt;T&gt;::impl&lt;Expr,State,Data&gt;::result_type</computeroutput>
  61. is calculated as follows:
  62. <itemizedlist>
  63. <listitem>
  64. <para>
  65. If <computeroutput>T</computeroutput> if of the form
  66. <computeroutput>O(A<subscript>0</subscript>,…A<subscript>n</subscript>)</computeroutput>, then let <computeroutput>O'</computeroutput>
  67. be <computeroutput>boost::result_of&lt;<classname>proto::make</classname>&lt;O&gt;(Expr, State, Data)&gt;::type</computeroutput>
  68. and let <computeroutput>T'</computeroutput> be <computeroutput>O'(A<subscript>0</subscript>,…A<subscript>n</subscript>)</computeroutput>.
  69. </para>
  70. </listitem>
  71. <listitem>
  72. <para>
  73. If <computeroutput>T</computeroutput> if of the form
  74. <computeroutput>O(A<subscript>0</subscript>,…A<subscript>n</subscript> ...)</computeroutput>, then let <computeroutput>O'</computeroutput>
  75. be <computeroutput>boost::result_of&lt;<classname>proto::make</classname>&lt;O&gt;(Expr, State, Data)&gt;::type</computeroutput>
  76. and let <computeroutput>T'</computeroutput> be <computeroutput>O'(A<subscript>0</subscript>,…A<subscript>n</subscript> ...)</computeroutput>.
  77. </para>
  78. </listitem>
  79. <listitem>
  80. <para>
  81. Otherwise, let <computeroutput>T'</computeroutput>
  82. be <computeroutput>boost::result_of&lt;<classname>proto::make</classname>&lt;T&gt;(Expr, State, Data)&gt;::type</computeroutput>.
  83. </para>
  84. </listitem>
  85. </itemizedlist>
  86. <para>
  87. The result type is
  88. <computeroutput>
  89. boost::result_of&lt;<classname>proto::call</classname>&lt;T'&gt;(Expr, State, Data)&gt;::type
  90. </computeroutput>.
  91. </para>
  92. </para>
  93. </description>
  94. </typedef>
  95. <method-group name="public member functions">
  96. <method name="operator()" cv="const">
  97. <type>result_type</type>
  98. <parameter name="expr">
  99. <paramtype>typename impl::expr_param</paramtype>
  100. </parameter>
  101. <parameter name="state">
  102. <paramtype>typename impl::state_param</paramtype>
  103. </parameter>
  104. <parameter name="data">
  105. <paramtype>typename impl::data_param</paramtype>
  106. </parameter>
  107. <description>
  108. <para>
  109. <computeroutput><classname>proto::lazy</classname>&lt;T&gt;::impl&lt;Expr,State,Data&gt;::operator()</computeroutput> behaves as follows:
  110. <itemizedlist>
  111. <listitem>
  112. <para>
  113. If <computeroutput>T</computeroutput> if of the form
  114. <computeroutput>O(A<subscript>0</subscript>,…A<subscript>n</subscript>)</computeroutput>, then let <computeroutput>O'</computeroutput>
  115. be <computeroutput>boost::result_of&lt;<classname>proto::make</classname>&lt;O&gt;(Expr, State, Data)&gt;::type</computeroutput>
  116. and let <computeroutput>T'</computeroutput> be <computeroutput>O'(A<subscript>0</subscript>,…A<subscript>n</subscript>)</computeroutput>.
  117. </para>
  118. </listitem>
  119. <listitem>
  120. <para>
  121. If <computeroutput>T</computeroutput> if of the form
  122. <computeroutput>O(A<subscript>0</subscript>,…A<subscript>n</subscript> ...)</computeroutput>, then let <computeroutput>O'</computeroutput>
  123. be <computeroutput>boost::result_of&lt;<classname>proto::make</classname>&lt;O&gt;(Expr, State, Data)&gt;::type</computeroutput>
  124. and let <computeroutput>T'</computeroutput> be <computeroutput>O'(A<subscript>0</subscript>,…A<subscript>n</subscript> ...)</computeroutput>.
  125. </para>
  126. </listitem>
  127. <listitem>
  128. <para>
  129. Otherwise, let <computeroutput>T'</computeroutput>
  130. be <computeroutput>boost::result_of&lt;<classname>proto::make</classname>&lt;T&gt;(Expr, State, Data)&gt;::type</computeroutput>.
  131. </para>
  132. </listitem>
  133. </itemizedlist>
  134. </para>
  135. </description>
  136. <returns>
  137. <para>
  138. <computeroutput>
  139. <classname>proto::call</classname>&lt;T'&gt;()(expr, state, data)
  140. </computeroutput>
  141. </para>
  142. </returns>
  143. </method>
  144. </method-group>
  145. </struct>
  146. </struct>
  147. </namespace>
  148. </namespace>
  149. </header>