2002-09-16 19:25:33 +00:00
<!doctype html public "-//ietf//dtd html//en">
2003-03-12 13:29:12 +00:00
< html >< head >< title > boost::mpl::lower_bound</ title >
2002-09-16 19:25:33 +00:00
< link rel = "stylesheet" href = "../mpl_wiki.css" >
</ head >< body bgcolor = "white" >
2003-03-12 13:29:12 +00:00
< 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 >
2002-09-16 19:25:33 +00:00
< p >
< pre >
template<
typename Sequence
, typename T
2003-03-12 13:29:12 +00:00
, typename Pred = < a href = "../Reference/less.html" > less</ a > < _,_>
2002-09-16 19:25:33 +00:00
>
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 >
2003-03-12 13:29:12 +00:00
#include "< a href = "../../../../../boost/mpl/lower_bound.hpp" > boost/mpl/lower_bound.hpp</ a > "
2002-09-16 19:25:33 +00:00
</ 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 = "../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 > Expression </ th >< th > Expression type </ th >< th > Precondition </ th >< th > Semantics </ th >< th > Postcondition </ th ></ tr >
< tr >< td >< code > typedef lower_bound< Sequence,T,Pred > ::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< Sequence> ::type, end< Sequence> ::type)</ code > such that, for every iterator < code > j</ code > in < code > [begin< Sequence> ::type, i)</ code > , < code > apply< lambda< Pred> ::type, j::type, T > ::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< Sequence> ::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< Sequence> ::type::value</ code > .
< p >
< h3 > Example</ h3 >
< p >
< pre >
typedef < a href = "../Reference/list_c.html" > list_c</ a > < int,1,2,3,3,3,5,8> numbers;
2003-03-12 13:29:12 +00:00
typedef lower_bound< numbers, int_< 3> > ::type iter;
2002-09-16 19:25:33 +00:00
BOOST_STATIC_ASSERT((< a href = "../Reference/distance.html" > distance</ a > < < a href = "../Reference/begin.html" > begin</ a > < numbers> ::type,iter > ::type::value == 2));
2003-03-12 13:29:12 +00:00
BOOST_STATIC_ASSERT(iter::type::value == 3);
2002-09-16 19:25:33 +00:00
</ pre >
< p >
< h3 > See also</ h3 >
< p >
2003-03-12 13:29:12 +00:00
< a href = "../Algorithms.html" > Algorithms</ a > , < code > sort</ code > , < code >< a href = "../Reference/upper_bound.html" > upper_bound</ a ></ code >
2002-09-16 19:25:33 +00:00
< p >< hr >
2003-03-12 13:29:12 +00:00
< a href = "../Table_of_Contents.html" > Table of Contents</ a >< br > Last edited March 10, 2003 5:43 am</ body ></ html >