Init
This commit is contained in:
63
cppdraft/lower/bound.md
Normal file
63
cppdraft/lower/bound.md
Normal file
@@ -0,0 +1,63 @@
|
||||
[lower.bound]
|
||||
|
||||
# 26 Algorithms library [[algorithms]](./#algorithms)
|
||||
|
||||
## 26.8 Sorting and related operations [[alg.sorting]](alg.sorting#lower.bound)
|
||||
|
||||
### 26.8.4 Binary search [[alg.binary.search]](alg.binary.search#lower.bound)
|
||||
|
||||
#### 26.8.4.2 lower_bound [lower.bound]
|
||||
|
||||
[ð](#lib:lower_bound)
|
||||
|
||||
`template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
||||
constexpr ForwardIterator
|
||||
lower_bound(ForwardIterator first, ForwardIterator last,
|
||||
const T& value);
|
||||
|
||||
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
||||
class Compare>
|
||||
constexpr ForwardIterator
|
||||
lower_bound(ForwardIterator first, ForwardIterator last,
|
||||
const T& value, Compare comp);
|
||||
|
||||
template<[forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11 Concept forward_iterator [iterator.concept.forward]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_for [iterator.concept.sentinel]")<I> S, class Proj = identity,
|
||||
class T = projected_value_t<I, Proj>,
|
||||
[indirect_strict_weak_order](indirectcallable.indirectinvocable#concept:indirect_strict_weak_order "24.3.6.3 Indirect callables [indirectcallable.indirectinvocable]")<const T*, projected<I, Proj>> Comp = ranges::less>
|
||||
constexpr I ranges::lower_bound(I first, S last, const T& value, Comp comp = {},
|
||||
Proj proj = {});
|
||||
template<[forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]") R, class Proj = identity,
|
||||
class T = projected_value_t<iterator_t<R>, Proj>,
|
||||
[indirect_strict_weak_order](indirectcallable.indirectinvocable#concept:indirect_strict_weak_order "24.3.6.3 Indirect callables [indirectcallable.indirectinvocable]")<const T*, projected<iterator_t<R>, Proj>> Comp =
|
||||
ranges::less>
|
||||
constexpr borrowed_iterator_t<R>
|
||||
ranges::lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L9436)
|
||||
|
||||
Let comp be less{} andproj be identity{} for overloads with no parameters by those names[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L9441)
|
||||
|
||||
*Preconditions*: The elements e of [first, last)
|
||||
are partitioned with respect to the expression
|
||||
|
||||
bool(invoke(comp, invoke(proj, e), value))[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L9447)
|
||||
|
||||
*Returns*: The furthermost iterator i in the range [first, last]
|
||||
such that for every iterator j in the range [first, i),bool(invoke(comp, invoke(proj, *j), value)) is true[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L9453)
|
||||
|
||||
*Complexity*: At most log2(last - first)+O(1) comparisons and projections[.](#4.sentence-1)
|
||||
Reference in New Issue
Block a user