diff options
Diffstat (limited to 'libs/proto/doc/reference/transform/arg.xml')
-rw-r--r-- | libs/proto/doc/reference/transform/arg.xml | 61 |
1 files changed, 23 insertions, 38 deletions
diff --git a/libs/proto/doc/reference/transform/arg.xml b/libs/proto/doc/reference/transform/arg.xml index 6256970f9d..ad25ac0a83 100644 --- a/libs/proto/doc/reference/transform/arg.xml +++ b/libs/proto/doc/reference/transform/arg.xml @@ -120,14 +120,27 @@ assert( ch == 'a' );</programlisting> <struct name="_data"> <inherit><classname>proto::transform</classname>< _data ></inherit> - <purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the current data unmodified. </purpose> + <purpose> + A <conceptname>PrimitiveTransform</conceptname> that returns the current data unmodified. + If the data (third) parameter is a transform environment, it returns the value associated + with the <code><classname>proto::data_type</classname></code> key. Otherwise, it returns + the data parameter unmodified. + </purpose> <description> <para> - Example: + If the data (third) parameter is a transform environment, it returns the value associated + with the <code><classname>proto::data_type</classname></code> key. Otherwise, it returns + the data parameter unmodified. + </para> + <para> + <emphasis role="bold">Example:</emphasis> <programlisting><classname>proto::terminal</classname><int>::type i = {42}; std::string str("hello"); -std::string & data = proto::_data()(i, 'a', str); -assert( &str == &data );</programlisting> +std::string & d1 = proto::_data()(i, 'a', str); +assert( &str == &d1 ); + +std::string & d2 = proto::_data()(i, 'a', (<globalname>proto::data</globalname> = boost::ref(str))); +assert( &str == &d2 );</programlisting> </para> </description> <struct name="impl"> @@ -136,40 +149,12 @@ assert( &str == &data );</programlisting> <template-type-parameter name="State"/> <template-type-parameter name="Data"/> </template> - <inherit><classname>proto::transform_impl</classname>< Expr, State, Data ></inherit> - <typedef name="result_type"> - <type>Data</type> - </typedef> - <method-group name="public member functions"> - <method name="operator()" cv="const"> - <type>Data</type> - <parameter name=""> - <paramtype>typename impl::expr_param</paramtype> - </parameter> - <parameter name=""> - <paramtype>typename impl::state_param</paramtype> - </parameter> - <parameter name="data"> - <paramtype>typename impl::data_param</paramtype> - <description> - <para>The current data. </para> - </description> - </parameter> - <description> - <para> - Returns the current data. - </para> - </description> - <returns> - <para> - <computeroutput>data</computeroutput> - </para> - </returns> - <throws> - <simpara>Will not throw.</simpara> - </throws> - </method> - </method-group> + <inherit><type> + mpl::if_c< + <classname>proto::is_env</classname><Data>::value, + <classname>proto::_env_var</classname><<classname>proto::data_type</classname>>, + <classname>proto::_env</classname> + >::type::template impl<Expr, State, Data></type></inherit> </struct> </struct> |