Back to Arangodb

lower_bound

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/lower-bound.html

3.12.9.13.2 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Querying Algorithms / lower_bound |

lower_bound

Synopsis

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;
};

Description

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)>

Parameters

ParameterRequirementDescription
SequenceForward SequenceA sorted sequence to search in.
TAny typeA type to search a position for.
PredBinary Lambda ExpressionA search criteria.

Expression semantics

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: |

Forward Iterator.

| | 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

|

Complexity

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.

Example

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 );

See also

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) |