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