Sophie

Sophie

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

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

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::find</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>find</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
      typename Sequence
    , typename T
    &gt;
struct find
{
    typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Finds the first occurrence of type <code>T</code> in a <code>Sequence</code>. 
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../boost/mpl/find.hpp">boost/mpl/find.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="../Forward_Sequence.html">Forward Sequence</a></td><td>A sequence to search in. </td></tr>
<tr><td><code>T</code></td><td>A type</td><td>The type to search for. </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 find&lt;Sequence,T&gt;::type i;</code></td><td>A model of <a href="../Forward_Iterator.html">Forward Iterator</a></td><td></td><td>Equivalent to <code>typedef <a href="../Reference/find_if.html">find_if</a>&lt;Sequence, is_same&lt;_,T&gt; &gt;::type i</code>; </td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Linear. At most <code>size&lt;Sequence&gt;::value</code> comparisons for identity. 
<p>
<h3>Example</h3>
<p>
<pre>
typedef <a href="../Reference/vector.html">vector</a>&lt;char,int,unsigned,long,unsigned long&gt; types;
typedef find&lt;types,unsigned&gt;::type iter;
BOOST_STATIC_ASSERT(iter::pos::value == 2);
</pre>
<p>
<h3>See also</h3>
<p>
<a href="../Algorithms.html">Algorithms</a>, <code><a href="../Reference/find_if.html">find_if</a></code>, <code><a href="../Reference/contains.html">contains</a></code>, <code><a href="../Reference/count.html">count</a></code>, <code><a href="../Reference/count_if.html">count_if</a></code>
<p><hr>
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited September 15, 2002 7:24 pm</body></html>