3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/lower-bound.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Querying Algorithms / lower_bound |
template<
typename Sequence
, typename T
, typename Pred =[less](./less.html)<[\_1](./placeholders.html),[\_2](./placeholders.html)>
>
struct[lower\_bound](./lower-bound.html){
typedef_unspecified_type;
};
Returns the first position in the sorted Sequence where T could be inserted without violating the ordering.
#include <[boost/mpl/lower\_bound.hpp](../../../../boost/mpl/lower_bound.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| Sequence | Forward Sequence | A sorted sequence to search in. |
| T | Any type | A type to search a position for. |
| Pred | Binary Lambda Expression | A search criteria. |
For any sorted Forward Sequence s, binary Lambda Expression pred, and arbitrary type x:
typedef[lower\_bound](./lower-bound.html)< s,x,pred >::type i;
| Return type: |
| | Semantics: |
i is the furthermost iterator in [begin<s>::type, end<s>::type) such that, for every iterator j in [begin<s>::type, i),
[apply](./apply.html)< pred,[deref](./deref.html)<j>::type, x >::type::value == true
|
The number of comparisons is logarithmic: at most log2( size<s>::value ) + 1. If s is a Random Access Sequence then the number of steps through the range is also logarithmic; otherwise, the number of steps is proportional to size<s>::value.
typedef[vector\_c](./vector-c.html)<int,1,2,3,3,3,5,8> numbers;
typedef[lower\_bound](./lower-bound.html)< numbers,[int\_](./int.html)<3> >::type iter;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)(
([distance](./distance.html)<[begin](./begin.html)<numbers>::type,iter >::value), ==, 2
);[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([deref](./deref.html)<iter>::type::value, ==, 3 );
Querying Algorithms, upper_bound, find, find_if, min_element
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |