Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > ef9bad9e14fc2a68cb7c992c11d75f5e > files > 3055

libboost1-devel-1.31.0-1mdk.i586.rpm

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::iter_fold</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>iter_fold</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
      typename Sequence
    , typename State
    , typename ForwardOp
    &gt;
struct iter_fold
{
    typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Returns the result of the successive application of binary <code>ForwardOp</code> to the result of the previous <code>ForwardOp</code> invocation (<code>State</code> if it's the first call) and each iterator in the range <code>[begin&lt;Sequence&gt;::type,end&lt;Sequence&gt;::type)</code> in the linear order.
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../boost/mpl/iter_fold.hpp">boost/mpl/iter_fold.hpp</a>"
</pre>
<p>
<h3>Parameters</h3>
<table border="1">
<tr><th>&nbsp;Parameter&nbsp;</th><th>&nbsp;Requirement&nbsp;</th><th>&nbsp;Description &nbsp;</th></tr>
<tr><td><code>Sequence</code></td><td>A model of <a href="../Sequence.html">Sequence</a></td><td>A sequence to iterate. </td></tr>
<tr><td><code>State</code></td><td>A type</td><td>The initial state for the first <code>ForwardOp</code> application. </td></tr>
<tr><td><code>ForwardOp</code></td><td>A model of [Lambda Function]</td><td>The operation to be executed on forward traversal. </td></tr>
</table>
<p>
<h3>Expression semantics</h3>
<p>
<table border="1">
<tr><th>&nbsp;Expression&nbsp;</th><th>&nbsp;Expression&nbsp;type&nbsp;</th><th>&nbsp;Precondition&nbsp;</th><th>&nbsp;Semantics&nbsp;</th><th>&nbsp;Postcondition&nbsp;</th></tr>
<tr><td><code>typedef iter_fold&lt;Sequence,T,Op&gt;::type t;</code></td><td>A type</td><td></td><td>Equivalent to <code>typedef lambda&lt;Op&gt;::type op; typedef begin&lt;Sequence&gt;::type i1; typedef apply&lt;op,T,i1&gt;::type t1; typedef i1::next i2; typedef apply&lt;op,t1,i2&gt;::type t2; ...; typedef apply&lt;op,T,in&gt;::type tn; typedef in::next last; typedef tn t</code>, where <code>n == size&lt;Sequence&gt;::type::value</code> and <code>last</code> is identical to <code>end&lt;Sequence&gt;::type</code>; Equivalent to <code>typedef T t;</code> if the sequence is empty.</td><td></td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Linear. Exactly <code><a href="../Reference/size.html">size</a>&lt;Sequence&gt;::type::value</code> applications of <code>ForwardOp</code>. 
<p>
<h3>Example</h3>
<p>
<pre>
typedef <a href="../Reference/list_c.html">list_c</a>&lt;int,5,-1,0,7,2,0,-5,4&gt; numbers;
typedef iter_fold&lt;
      numbers
    , <a href="../Reference/begin.html">begin</a>&lt;numbers&gt;::type
    , if_&lt; <a href="../Reference/less.html">less</a>&lt; <a href="../Reference/deref.html">deref</a>&lt;_1&gt;, <a href="../Reference/deref.html">deref</a>&lt;_2&gt; &gt;,_2,_1 &gt;
    &gt;::type max_element_iter;
<p>
BOOST_STATIC_ASSERT(max_element_iter::type::value == 7);
</pre>
<p>
<h3>See also</h3>
<p>
<a href="../Algorithms.html">Algorithms</a>, <code><a href="../Reference/iter_fold_backward.html">iter_fold_backward</a></code>, <code><a href="../Reference/fold.html">fold</a></code>, <code><a href="../Reference/fold_backward.html">fold_backward</a></code>, <code><a href="../Reference/copy.html">copy</a></code>, <code><a href="../Reference/copy_backward.html">copy_backward</a></code>
<p><hr>
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited July 19, 2002 1:16 am</body></html>