mirror of
https://github.com/boostorg/proto.git
synced 2026-01-27 07:02:14 +00:00
447 lines
22 KiB
XML
447 lines
22 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<header name="boost/proto/make_expr.hpp">
|
|
<para>
|
|
Definition of the <computeroutput><functionname alt="boost::proto::make_expr">proto::make_expr()</functionname>
|
|
</computeroutput> and <computeroutput><functionname alt="boost::proto::unpack_expr">proto::unpack_expr()</functionname>
|
|
</computeroutput> utilities for building Proto expression nodes from child nodes or from a Fusion sequence of child
|
|
nodes, respectively.
|
|
</para>
|
|
<namespace name="boost">
|
|
<namespace name="proto">
|
|
<namespace name="functional">
|
|
<!-- proto::functional::make_expr -->
|
|
<struct name="make_expr">
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Domain">
|
|
<default><classname>proto::deduce_domain</classname></default>
|
|
</template-type-parameter>
|
|
</template>
|
|
<purpose>A <conceptname>PolymorphicFunctionObject</conceptname> equivalent to the <computeroutput>
|
|
<functionname alt="proto::make_expr">proto::make_expr()</functionname></computeroutput> function.</purpose>
|
|
<description>
|
|
<para>
|
|
In all cases, <computeroutput>proto::functional::make_expr<Tag, Domain>()(a...)</computeroutput>
|
|
is equivalent to <computeroutput><functionname>proto::make_expr</functionname><Tag, Domain>(a...)</computeroutput>.
|
|
</para>
|
|
<para>
|
|
<computeroutput>proto::functional::make_expr<Tag>()(a...)</computeroutput> is equivalent to
|
|
<computeroutput><functionname>proto::make_expr</functionname><Tag>(a...)</computeroutput>.
|
|
</para>
|
|
</description>
|
|
<inherit>
|
|
<type><classname>proto::callable</classname></type>
|
|
</inherit>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="A" pack="1"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(A...)</template-arg>
|
|
</specialization>
|
|
<inherit>
|
|
<type>
|
|
<classname>proto::result_of::make_expr</classname>< Tag, Domain, A... ></type>
|
|
</inherit>
|
|
</struct-specialization>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>typename <classname>proto::result_of::make_expr</classname>< Tag, Domain, A const... >::type const</type>
|
|
<template>
|
|
<template-type-parameter name="A" pack="1"/>
|
|
</template>
|
|
<parameter name="a" pack="1">
|
|
<paramtype>A const &</paramtype>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Construct an expression node with tag type <computeroutput>Tag</computeroutput> and in the
|
|
domain <computeroutput>Domain</computeroutput>.
|
|
</para>
|
|
<para>
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput><functionname>proto::make_expr</functionname><Tag, Domain>(a...)</computeroutput>
|
|
</para>
|
|
</returns>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
|
|
<!-- proto::functional::unpack_expr -->
|
|
<struct name="unpack_expr">
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Domain">
|
|
<default><classname>proto::deduce_domain</classname></default>
|
|
</template-type-parameter>
|
|
</template>
|
|
<purpose>A <conceptname>PolymorphicFunctionObject</conceptname> equivalent to the
|
|
<computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname></computeroutput> function.
|
|
</purpose>
|
|
<description>
|
|
<para>
|
|
In all cases, <computeroutput>proto::functional::unpack_expr<Tag, Domain>()(seq)</computeroutput> is
|
|
equivalent to <computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname><Tag,
|
|
Domain>(seq)</computeroutput>.
|
|
</para>
|
|
<para>
|
|
<computeroutput>proto::functional::unpack_expr<Tag>()(seq)</computeroutput> is equivalent to
|
|
<computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname><Tag>(seq)</computeroutput>.
|
|
</para>
|
|
</description>
|
|
<inherit>
|
|
<type><classname>proto::callable</classname></type>
|
|
</inherit>
|
|
<struct-specialization name="result">
|
|
<template>
|
|
<template-type-parameter name="This"/>
|
|
<template-type-parameter name="Sequence"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>This(Sequence)</template-arg>
|
|
</specialization>
|
|
<inherit>
|
|
<type>
|
|
<classname>proto::result_of::unpack_expr</classname><
|
|
Tag,
|
|
Domain,
|
|
typename boost::remove_reference< Sequence >::type
|
|
></type>
|
|
</inherit>
|
|
</struct-specialization>
|
|
<method-group name="public member functions">
|
|
<method name="operator()" cv="const">
|
|
<type>typename <classname>proto::result_of::unpack_expr</classname>< Tag, Domain, Sequence const >::type const</type>
|
|
<template>
|
|
<template-type-parameter name="Sequence"/>
|
|
</template>
|
|
<parameter name="sequence">
|
|
<paramtype>Sequence const &</paramtype>
|
|
<description>
|
|
<para>A Fusion Forward Sequence </para>
|
|
</description>
|
|
</parameter>
|
|
<description>
|
|
<para>
|
|
Construct an expression node with tag type <computeroutput>Tag</computeroutput> and in the
|
|
domain <computeroutput>Domain</computeroutput>.
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput><functionname>proto::unpack_expr</functionname><Tag, Domain>(sequence)</computeroutput>
|
|
</para>
|
|
</returns>
|
|
</method>
|
|
</method-group>
|
|
</struct>
|
|
</namespace>
|
|
|
|
<namespace name="result_of">
|
|
<!-- proto::result_of::make_expr -->
|
|
<struct name="make_expr">
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="A" pack="1"/>
|
|
</template>
|
|
<purpose>Metafunction that computes the return type of the
|
|
<computeroutput><functionname alt="proto::make_expr">proto::make_expr()</functionname></computeroutput>
|
|
function, with a domain deduced from the domains of the children.</purpose>
|
|
<description>
|
|
<para>
|
|
Computes the return type of the
|
|
<computeroutput><functionname alt="proto::make_expr">proto::make_expr()</functionname></computeroutput> function.
|
|
</para>
|
|
<para>
|
|
In this specialization, the domain is deduced from the domains of the child types.
|
|
If <computeroutput><classname>proto::is_domain</classname><A<subscript>0</subscript>>::value</computeroutput>
|
|
is <computeroutput>true</computeroutput>, then another specialization is selected.
|
|
</para>
|
|
</description>
|
|
<typedef name="D">
|
|
<purpose>For exposition only</purpose>
|
|
<type><replaceable>domain-deduced-from-child-types</replaceable></type>
|
|
<description>
|
|
<para>
|
|
For each <computeroutput>x</computeroutput> in <computeroutput>[0,N)</computeroutput>
|
|
(proceeding in order beginning with <computeroutput>x=0</computeroutput>), if
|
|
<computeroutput><classname>proto::domain_of</classname><A<subscript>x</subscript>>::type</computeroutput> is not
|
|
<computeroutput><classname>proto::default_domain</classname></computeroutput>, then
|
|
<computeroutput>D</computeroutput> is
|
|
<computeroutput><classname>proto::domain_of</classname><A<subscript>x</subscript>>::type</computeroutput>.
|
|
Otherwise, <computeroutput>D</computeroutput> is
|
|
<computeroutput><classname>proto::default_domain</classname></computeroutput>.
|
|
</para>
|
|
</description>
|
|
</typedef>
|
|
<typedef name="type">
|
|
<type>typename <classname>proto::result_of::make_expr</classname><Tag, D, A...>::type</type>
|
|
</typedef>
|
|
</struct>
|
|
<struct-specialization name="make_expr">
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Domain"/>
|
|
<template-type-parameter name="A" pack="1"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>Tag</template-arg>
|
|
<template-arg>Domain</template-arg>
|
|
<template-arg pack="1">A</template-arg>
|
|
</specialization>
|
|
<purpose>Metafunction that computes the return type of the
|
|
<computeroutput><functionname alt="proto::make_expr">proto::make_expr()</functionname></computeroutput>
|
|
function, within the specified domain.</purpose>
|
|
<description>
|
|
<para>
|
|
Computes the return type of the
|
|
<computeroutput><functionname alt="proto::make_expr">proto::make_expr()</functionname></computeroutput>
|
|
function.
|
|
</para>
|
|
</description>
|
|
<typedef name="type">
|
|
<description>
|
|
<para>
|
|
If <computeroutput>Tag</computeroutput> is
|
|
<computeroutput><classname>proto::tag::terminal</classname></computeroutput>, then
|
|
<computeroutput>type</computeroutput> is a typedef for
|
|
<computeroutput>boost::result_of<Domain(<classname>proto::expr</classname><
|
|
<classname>proto::tag::terminal</classname>, <classname>proto::term</classname><
|
|
A<subscript>0</subscript> > >)>::type</computeroutput>.
|
|
</para>
|
|
<para>
|
|
Otherwise, <computeroutput>type</computeroutput> is a typedef for
|
|
<computeroutput>boost::result_of<Domain(<classname>proto::expr</classname><
|
|
Tag, <classname alt="proto::listN">proto::list<emphasis>N</emphasis></classname><
|
|
typename <classname>proto::result_of::as_child</classname><A>::type...> >)>::type</computeroutput>
|
|
</para>
|
|
</description>
|
|
<type><emphasis>see-below</emphasis></type>
|
|
</typedef>
|
|
</struct-specialization>
|
|
<!-- proto::result_of::unpack_expr -->
|
|
<struct name="unpack_expr">
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Sequence"/>
|
|
<template-type-parameter name="Void">
|
|
<default><type>void</type></default>
|
|
</template-type-parameter>
|
|
</template>
|
|
<purpose>Metafunction that computes the return type of the
|
|
<computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname></computeroutput>
|
|
function, with a domain deduced from the domains of the children.
|
|
</purpose>
|
|
<description>
|
|
<para>
|
|
Compute the return type of the
|
|
<computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname></computeroutput>
|
|
function.
|
|
</para>
|
|
<para>
|
|
<computeroutput>Sequence</computeroutput> is a Fusion Forward Sequence.
|
|
</para>
|
|
<para>
|
|
In this specialization, the domain is deduced from the domains of the child types.
|
|
If <computeroutput><classname>proto::is_domain</classname><Sequence>::value</computeroutput>
|
|
is <computeroutput>true</computeroutput>, then another specialization is selected.
|
|
</para>
|
|
</description>
|
|
<typedef name="type">
|
|
<purpose>Where S is a RandomAccessSequence equivalent to Sequence, and N is the size of S.</purpose>
|
|
<type>
|
|
typename <classname>proto::result_of::make_expr</classname><
|
|
Tag,
|
|
typename fusion::result_of::value_at_c<<replaceable>S</replaceable>, 0>::type,
|
|
...
|
|
typename fusion::result_of::value_at_c<<replaceable>S</replaceable>, <replaceable>N</replaceable>-1>::type
|
|
>::type
|
|
</type>
|
|
</typedef>
|
|
</struct>
|
|
<struct-specialization name="unpack_expr">
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Domain"/>
|
|
<template-type-parameter name="Sequence"/>
|
|
</template>
|
|
<specialization>
|
|
<template-arg>Tag</template-arg>
|
|
<template-arg>Domain</template-arg>
|
|
<template-arg>Sequence</template-arg>
|
|
</specialization>
|
|
<purpose>Metafunction that computes the return type of the
|
|
<computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname></computeroutput>
|
|
function, within the specified domain.
|
|
</purpose>
|
|
<description>
|
|
<para>
|
|
Computes the return type of the
|
|
<computeroutput><functionname alt="proto::unpack_expr">proto::unpack_expr()</functionname></computeroutput>
|
|
function.
|
|
</para>
|
|
</description>
|
|
<typedef name="type">
|
|
<purpose>Where S is a RandomAccessSequence equivalent to Sequence, and N is the size of S.</purpose>
|
|
<type>
|
|
typename <classname>proto::result_of::make_expr</classname><
|
|
Tag,
|
|
Domain,
|
|
typename fusion::result_of::value_at_c<<replaceable>S</replaceable>, 0>::type,
|
|
...
|
|
typename fusion::result_of::value_at_c<<replaceable>S</replaceable>, <replaceable>N</replaceable>-1>::type
|
|
>::type
|
|
</type>
|
|
</typedef>
|
|
</struct-specialization>
|
|
</namespace>
|
|
|
|
<!-- proto::make_expr() -->
|
|
<overloaded-function name="make_expr">
|
|
<signature>
|
|
<type>typename <classname>proto::result_of::make_expr</classname><Tag, A const...>::type const</type>
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="A" pack="1"/>
|
|
</template>
|
|
<parameter name="a" pack="1">
|
|
<paramtype>A const &</paramtype>
|
|
</parameter>
|
|
</signature>
|
|
<signature>
|
|
<type>typename <classname>proto::result_of::make_expr</classname><Tag, Domain, A const...>::type const</type>
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Domain"/>
|
|
<template-type-parameter name="A" pack="1"/>
|
|
</template>
|
|
<parameter name="a" pack="1">
|
|
<paramtype>A const &</paramtype>
|
|
</parameter>
|
|
</signature>
|
|
<purpose>Construct an expression of the requested tag type with a domain and with the specified
|
|
arguments as children.</purpose>
|
|
<description>
|
|
<para>
|
|
This function template may be invoked either with or without specifying a
|
|
<computeroutput>Domain</computeroutput> template parameter. If no domain is specified, the domain
|
|
is deduced by examining in order the domains of the given arguments and taking the first that is
|
|
not <computeroutput><classname>proto::default_domain</classname></computeroutput>, if any such
|
|
domain exists, or <computeroutput><classname>proto::default_domain</classname></computeroutput>
|
|
otherwise.
|
|
</para>
|
|
<para>
|
|
Let <computeroutput><replaceable>WRAP</replaceable>(x)</computeroutput> be defined such that:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
If <computeroutput>x</computeroutput> is a <computeroutput>boost::reference_wrapper<></computeroutput>,
|
|
<computeroutput><replaceable>WRAP</replaceable>(x)</computeroutput> is equivalent to
|
|
<computeroutput><functionname>proto::as_child</functionname><Domain>(x.get())</computeroutput>.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
Otherwise, <computeroutput><replaceable>WRAP</replaceable>(x)</computeroutput> is equivalent to
|
|
<computeroutput><functionname>proto::as_expr</functionname><Domain>(x)</computeroutput>.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
Let <computeroutput><replaceable>MAKE</replaceable><Tag>(a...)</computeroutput> be defined as
|
|
<computeroutput><classname>proto::expr</classname><Tag,
|
|
<classname alt="proto::listN">proto::list<emphasis>N</emphasis></classname><A...> >::make(a...)</computeroutput>
|
|
where
|
|
<computeroutput>A<subscript>x</subscript></computeroutput> is the type of
|
|
<computeroutput>a<subscript>x</subscript></computeroutput>.
|
|
</para>
|
|
<para>
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput>Domain()(<replaceable>MAKE</replaceable><Tag>(<replaceable>WRAP</replaceable>(a)...))</computeroutput>.
|
|
</para>
|
|
</returns>
|
|
</overloaded-function>
|
|
|
|
<!-- proto::unpack_expr() -->
|
|
<overloaded-function name="unpack_expr">
|
|
<signature>
|
|
<type>typename <classname>proto::result_of::unpack_expr</classname><Tag, Sequence const>::type const</type>
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Sequence"/>
|
|
</template>
|
|
<parameter name="sequence">
|
|
<paramtype>Sequence const &</paramtype>
|
|
<description>
|
|
<para>A Fusion Forward Sequence.</para>
|
|
</description>
|
|
</parameter>
|
|
</signature>
|
|
<signature>
|
|
<type>typename <classname>proto::result_of::unpack_expr</classname><Tag, Domain, Sequence const>::type const</type>
|
|
<template>
|
|
<template-type-parameter name="Tag"/>
|
|
<template-type-parameter name="Domain"/>
|
|
<template-type-parameter name="Sequence"/>
|
|
</template>
|
|
<parameter name="sequence">
|
|
<paramtype>Sequence const &</paramtype>
|
|
</parameter>
|
|
</signature>
|
|
<purpose>Construct an expression of the requested tag type with a domain and with children
|
|
from the specified Fusion Forward Sequence.</purpose>
|
|
<description>
|
|
<para>
|
|
This function template may be invoked either with or without specifying a
|
|
<computeroutput>Domain</computeroutput> argument. If no domain is specified, the domain is
|
|
deduced by examining in order the domains of the elements of <computeroutput>sequence</computeroutput>
|
|
and taking the first that is not
|
|
<computeroutput><classname>proto::default_domain</classname></computeroutput>, if any such domain
|
|
exists, or <computeroutput><classname>proto::default_domain</classname></computeroutput> otherwise.
|
|
</para>
|
|
<para>
|
|
Let <computeroutput>s</computeroutput> be a Fusion Random Access Sequence equivalent to
|
|
<computeroutput>sequence</computeroutput>.
|
|
Let <computeroutput><replaceable>WRAP</replaceable><N>(s)</computeroutput>, where
|
|
<computeroutput>s</computeroutput> has type <computeroutput>S</computeroutput>, be defined such that:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
If <computeroutput>fusion::result_of::value_at_c<S,N>::type</computeroutput> is a reference,
|
|
<computeroutput><replaceable>WRAP</replaceable><N>(s)</computeroutput> is equivalent to
|
|
<computeroutput><functionname>proto::as_child</functionname><Domain>(fusion::at_c<N>(s))</computeroutput>.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
Otherwise, <computeroutput><replaceable>WRAP</replaceable><N>(s)</computeroutput> is equivalent to
|
|
<computeroutput><functionname>proto::as_expr</functionname><Domain>(fusion::at_c<N>(s))</computeroutput>.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
Let <computeroutput><replaceable>MAKE</replaceable><Tag>(a...)</computeroutput> be defined as
|
|
<computeroutput><classname>proto::expr</classname><Tag,
|
|
<classname alt="proto::listN">proto::list<emphasis>N</emphasis></classname><A...> >::make(a...)</computeroutput>
|
|
where
|
|
<computeroutput>A<subscript>x</subscript></computeroutput> is the type of
|
|
<computeroutput>a<subscript>x</subscript></computeroutput>.
|
|
</para>
|
|
</description>
|
|
<returns>
|
|
<para>
|
|
<computeroutput>Domain()(<replaceable>MAKE</replaceable><Tag>(<replaceable>WRAP</replaceable><0>(s),...
|
|
<replaceable>WRAP</replaceable><<replaceable>N</replaceable>-1>(s)))</computeroutput>, where
|
|
<replaceable>N</replaceable> is the size of <computeroutput>Sequence</computeroutput>.
|
|
</para>
|
|
</returns>
|
|
</overloaded-function>
|
|
</namespace>
|
|
</namespace>
|
|
</header>
|