Sophie

Sophie

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

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

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::lower_bound</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>lower_bound</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
      typename Sequence
    , typename T
    , typename Pred = <a href="../Reference/less.html">less</a>&lt;_,_&gt;
    &gt;
struct lower_bound
{
    typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Returns the first position in the sorted <code>Sequence</code> where <code>T</code> could be inserted without violating the ordering.
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../boost/mpl/lower_bound.hpp">boost/mpl/lower_bound.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 sorted sequence. </td></tr>
<tr><td><code>T</code></td><td>A type</td><td>A type to search the position for. </td></tr>
<tr><td><code>Pred</code></td><td>A model of binary Predicate [Lambda Expression]</td><td>A sort criteria. </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 lower_bound&lt; Sequence,T,Pred &gt;::type i;</code></td><td>A model of <a href="../Forward_Iterator.html">Forward Iterator</a></td><td></td><td><code>i</code> is the furthermost iterator in <code>[begin&lt;Sequence&gt;::type, end&lt;Sequence&gt;::type)</code> such that, for every iterator <code>j</code> in <code>[begin&lt;Sequence&gt;::type, i)</code>, <code>apply&lt; lambda&lt;Pred&gt;::type, j::type, T &gt;::type::value == true</code>.</td><td></td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
The number of comparisons is logarithmic: at most <code>log(size&lt;Sequence&gt;::type::value) + 1</code>. If <code>Sequence</code> is a <a href="../Random_Access_Sequence.html">Random Access Sequence</a> then the number of steps through the range is also logarithmic; otherwise, the number of steps is proportional to <code>size&lt;Sequence&gt;::type::value</code>.
<p>
<h3>Example</h3>
<p>
<pre>
typedef <a href="../Reference/list_c.html">list_c</a>&lt;int,1,2,3,3,3,5,8&gt; numbers;
typedef lower_bound&lt; numbers, int_&lt;3&gt; &gt;::type iter;
BOOST_STATIC_ASSERT((<a href="../Reference/distance.html">distance</a>&lt; <a href="../Reference/begin.html">begin</a>&lt;numbers&gt;::type,iter &gt;::type::value == 2));
BOOST_STATIC_ASSERT(iter::type::value == 3);
</pre>
<p>
<h3>See also</h3>
<p>
<a href="../Algorithms.html">Algorithms</a>, <code>sort</code>, <code><a href="../Reference/upper_bound.html">upper_bound</a></code>
<p><hr>
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited March 10, 2003 5:43 am</body></html>