mirror of
https://github.com/boostorg/mpl.git
synced 2026-01-26 17:02:20 +01:00
59 lines
2.8 KiB
HTML
59 lines
2.8 KiB
HTML
<!doctype html public "-//ietf//dtd html//en">
|
|
<html><head><title>boost::mpl::transform</title>
|
|
<link rel="stylesheet" href="../mpl_wiki.css">
|
|
</head><body bgcolor="white">
|
|
<h1><a href="../Table_of_Contents.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>transform</h1><h3>Synopsis</h3>
|
|
<p>
|
|
<pre>
|
|
template<
|
|
typename Sequence
|
|
, typename Op
|
|
>
|
|
struct transform
|
|
{
|
|
typedef <em>unspecified</em> type;
|
|
};
|
|
</pre>
|
|
<p>
|
|
<h3>Description</h3>
|
|
<p>
|
|
Performs a transformation on the sequence. The algorithm returns a new sequence produced by applying the unary metafunction <code>Op</code> to every element in the <code>[begin<Sequence>::type, end<Sequence>::type)</code> range. The result sequence preserves all the functional and performance characteristics of the original <code>Sequence</code>, including its size, but not identity.
|
|
<p>
|
|
<h3>Definition</h3>
|
|
<p>
|
|
<pre>
|
|
#include "<a href="../../../../../boost/mpl/transform.hpp">boost/mpl/transform.hpp</a>"
|
|
</pre>
|
|
<p>
|
|
<h3>Parameters</h3>
|
|
<table border="1">
|
|
<tr><th> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
|
<tr><td><code>Sequence</code></td><td>A model of <a href="../Extensible_Sequence.html">Extensible Sequence</a></td><td>The original sequence. </td></tr>
|
|
<tr><td><code>Op</code></td><td>An unary [Lambda Expression]</td><td>A transformation. </td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Expression semantics</h3>
|
|
<p>
|
|
<table border="1">
|
|
<tr><th> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
|
<tr><td><code>typedef transform<Sequence,Op>::type s;</code></td><td>A model of <a href="../Extensible_Sequence.html">Extensible Sequence</a></td><td></td><td></td><td><code>size<s>::type::value == size<Sequence>::type::value</code>. </td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Complexity</h3>
|
|
<p>
|
|
Linear. The operation <code>Op</code> is applied exactly <code><a href="../Reference/size.html">size</a><Sequence>::type::value</code> times.
|
|
<p>
|
|
<h3>Example</h3>
|
|
<p>
|
|
<pre>
|
|
typedef <a href="../Reference/list.html">list</a><char,short,int,long,float,double> types;
|
|
typedef <a href="../Reference/list.html">list</a><char*,short*,int*,long*,float*,double*> pointers;
|
|
typedef transform< types,boost::add_pointer<_1> >::type result;
|
|
BOOST_STATIC_ASSERT((<a href="../Reference/equal.html">equal</a><result,pointers>::value));
|
|
</pre>
|
|
<p>
|
|
<h3>See also</h3>
|
|
<p>
|
|
<a href="../Algorithms.html">Algorithms</a>, <code><a href="../Reference/replace.html">replace</a></code>, <code><a href="../Reference/replace_if.html">replace_if</a></code>, <code><a href="../Reference/transform.html">transform</a></code>
|
|
<p><hr>
|
|
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited July 17, 2002 5:47 am</body></html> |