123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <?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/call.hpp">
- <para>Contains definition of the call<> transform. </para>
- <namespace name="boost">
- <namespace name="proto">
- <struct name="call">
- <template>
- <template-type-parameter name="T"/>
- </template>
- <purpose>Make the given <conceptname>CallableTransform</conceptname> into a <conceptname>PrimitiveTransform</conceptname>.</purpose>
- <description>
- <para>
- The purpose of <computeroutput>proto::call<></computeroutput> is to annotate a transform as callable
- so that <computeroutput><classname alt="proto::when">proto::when<></classname></computeroutput> knows
- how to apply it. The template parameter must be either a <conceptname>PrimitiveTransform</conceptname> or a
- <conceptname>CallableTransform</conceptname>; that is, a function type for which the return type is a callable
- <conceptname>PolymorphicFunctionObject</conceptname>.
- </para>
- <para>
- For the complete description of the behavior of the <computeroutput>proto::call<></computeroutput>
- transform, see the documentation for the nested
- <computeroutput>
- <classname alt="proto::call::impl">proto::call::impl<></classname>
- </computeroutput>
- class template.
- </para>
- </description>
- <inherit><type><classname>proto::transform</classname>< call<T> ></type></inherit>
- <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="result_type">
- <type><replaceable>see-below</replaceable></type>
- <description>
- <para>
- In the description that follows, a type <computeroutput>T</computeroutput> is determined to model the
- <conceptname>PrimitiveTransform</conceptname> concept if
- <computeroutput><classname>proto::is_transform</classname><T>::value</computeroutput> is
- <computeroutput>true</computeroutput>.
- </para>
- <para>
- <computeroutput><classname>proto::call</classname><T>::impl<Expr,State,Data>::result_type</computeroutput>
- is computed as follows:
- <itemizedlist>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> if of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname></computeroutput> or
- <computeroutput><conceptname>PrimitiveTransform</conceptname>()</computeroutput>, then
- <computeroutput>result_type</computeroutput> is:
- <programlisting>typename boost::result_of<PrimitiveTransform(Expr, State, Data)>::type</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname>(A<subscript>0</subscript>)</computeroutput>, then
- <computeroutput>result_type</computeroutput> is:
- <programlisting>typename boost::result_of<PrimitiveTransform(
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>(Expr, State, Data)>::type,
- State,
- Data
- )>::type</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname>(A<subscript>0</subscript>, A<subscript>1</subscript>)</computeroutput>, then
- <computeroutput>result_type</computeroutput> is:
- <programlisting>typename boost::result_of<PrimitiveTransform(
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>(Expr, State, Data)>::type,
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>1</subscript>>(Expr, State, Data)>::type,
- Data
- )>::type</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname>(A<subscript>0</subscript>, A<subscript>1</subscript>, A<subscript>2</subscript>)</computeroutput>, then
- <computeroutput>result_type</computeroutput> is:
- <programlisting>typename boost::result_of<PrimitiveTransform(
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>(Expr, State, Data)>::type,
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>1</subscript>>(Expr, State, Data)>::type,
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>2</subscript>>(Expr, State, Data)>::type
- )>::type</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(A<subscript>0</subscript>,…A<subscript>n</subscript>)</computeroutput>, then
- <computeroutput>result_type</computeroutput> is:
- <programlisting>typename boost::result_of<PolymorphicFunctionObject(
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>(Expr, State, Data)>::type,
- …
- typename boost::result_of<<classname>when</classname><<classname>_</classname>,A<subscript>n</subscript>>(Expr, State, Data)>::type
- >::type</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(A<subscript>0</subscript>,…A<subscript>n</subscript> ...)</computeroutput>, then
- let <computeroutput>T'</computeroutput> be <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(A<subscript>0</subscript>,…A<subscript>n-1</subscript>, <replaceable>S</replaceable>)</computeroutput>,
- where <replaceable>S</replaceable> is a type sequence computed from the unpacking expression <computeroutput>A<subscript>n</subscript></computeroutput>
- as described in the reference for <computeroutput><classname>proto::pack</classname></computeroutput>.
- Then, <computeroutput>result_type</computeroutput> is:
- <programlisting><computeroutput>typename <classname>proto::call</classname><T'>::impl<Expr,State,Data>::result_type</computeroutput></programlisting>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </description>
- </typedef>
- <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>
- <para>
- In the description that follows, a type <computeroutput>T</computeroutput> is determined to model the
- <conceptname>PrimitiveTransform</conceptname> concept if
- <computeroutput><classname>proto::is_transform</classname><T>::value</computeroutput> is
- <computeroutput>true</computeroutput>.
- </para>
- <para>
- <computeroutput><classname>proto::call</classname><T>::impl<Expr,State,Data>::operator()</computeroutput> behaves as follows:
- <itemizedlist>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> if of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname></computeroutput> or
- <computeroutput><conceptname>PrimitiveTransform</conceptname>()</computeroutput>, then
- return
- <programlisting>PrimitiveTransform()(expr, state, data)</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname>(A<subscript>0</subscript>)</computeroutput>, then
- return
- <programlisting>PrimitiveTransform()(
- <classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>()(expr, state, data),
- state,
- sata
- )</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname>(A<subscript>0</subscript>, A<subscript>1</subscript>)</computeroutput>, then
- return:
- <programlisting>PrimitiveTransform()(
- <classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>()(expr, state, data),
- <classname>when</classname><<classname>_</classname>,A<subscript>1</subscript>>()(expr, state, data),
- Data
- )</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PrimitiveTransform</conceptname>(A<subscript>0</subscript>, A<subscript>1</subscript>, A<subscript>2</subscript>)</computeroutput>, then
- return
- <programlisting>PrimitiveTransform()(
- <classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>()(expr, state, data),
- <classname>when</classname><<classname>_</classname>,A<subscript>1</subscript>>()(expr, state, data),
- <classname>when</classname><<classname>_</classname>,A<subscript>2</subscript>>()(expr, state, data)
- )</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(A<subscript>0</subscript>,…A<subscript>n</subscript>)</computeroutput>, then
- return:
- <programlisting>PolymorphicFunctionObject()(
- <classname>when</classname><<classname>_</classname>,A<subscript>0</subscript>>()(expr, state, data),
- ...
- <classname>when</classname><<classname>_</classname>,A<subscript>n</subscript>>()(expr, state, data)
- )</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- If <computeroutput>T</computeroutput> is of the form
- <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(A<subscript>0</subscript>,…A<subscript>n</subscript> ...)</computeroutput>, then
- let <computeroutput>T'</computeroutput> be <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(A<subscript>0</subscript>,…A<subscript>n-1</subscript>, <replaceable>S</replaceable>)</computeroutput>,
- where <replaceable>S</replaceable> is a type sequence computed from the unpacking expression <computeroutput>A<subscript>n</subscript></computeroutput>
- as described in the reference for <computeroutput><classname>proto::pack</classname></computeroutput>.
- Then, return:
- <programlisting><computeroutput><classname>proto::call</classname><T'>()(expr, state, data)</computeroutput></programlisting>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </description>
- </method>
- </method-group>
- </struct>
- </struct>
- </namespace>
- </namespace>
- </header>
|