103 lines
6.9 KiB
Markdown
103 lines
6.9 KiB
Markdown
[alg.ends.with]
|
||
|
||
# 26 Algorithms library [[algorithms]](./#algorithms)
|
||
|
||
## 26.6 Non-modifying sequence operations [[alg.nonmodifying]](alg.nonmodifying#alg.ends.with)
|
||
|
||
### 26.6.17 Ends with [alg.ends.with]
|
||
|
||
[ð](#lib:ends_with)
|
||
|
||
`template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_iterator [iterator.concept.input]") I1, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_for [iterator.concept.sentinel]")<I1> S1, [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_iterator [iterator.concept.input]") I2, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_for [iterator.concept.sentinel]")<I2> S2,
|
||
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
||
requires ([forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11 Concept forward_iterator [iterator.concept.forward]")<I1> || [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<S1, I1>) &&
|
||
([forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11 Concept forward_iterator [iterator.concept.forward]")<I2> || [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<S2, I2>) &&
|
||
[indirectly_comparable](alg.req.ind.cmp#concept:indirectly_comparable "24.3.7.5 Concept indirectly_comparable [alg.req.ind.cmp]")<I1, I2, Pred, Proj1, Proj2>
|
||
constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
||
Proj1 proj1 = {}, Proj2 proj2 = {});
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6091)
|
||
|
||
Let N1 be last1 - first1 andN2 be last2 - first2[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6095)
|
||
|
||
*Returns*: false if N1 < N2, otherwise:ranges::equal(std::move(first1) + (N1 - N2), last1, std::move(first2), last2,
|
||
pred, proj1, proj2)
|
||
|
||
[ð](#itemdecl:2)
|
||
|
||
`template<[execution-policy](algorithms.parallel.defns#concept:execution-policy "26.3.1 Preamble [algorithms.parallel.defns]") Ep, [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13 Concept random_access_iterator [iterator.concept.random.access]") I1, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<I1> S1,
|
||
[random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13 Concept random_access_iterator [iterator.concept.random.access]") I2, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<I2> S2,
|
||
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
||
requires [indirectly_comparable](alg.req.ind.cmp#concept:indirectly_comparable "24.3.7.5 Concept indirectly_comparable [alg.req.ind.cmp]")<I1, I2, Pred, Proj1, Proj2>
|
||
bool ranges::ends_with(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
||
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6114)
|
||
|
||
Let N1 be last1 - first1 andN2 be last2 - first2[.](#3.sentence-1)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6118)
|
||
|
||
*Returns*: false if N1 < N2, otherwise:ranges::equal(std::forward<Ep>(exec), std::move(first1) + (N1 - N2), last1,
|
||
std::move(first2), last2, pred, proj1, proj2)
|
||
|
||
[ð](#itemdecl:3)
|
||
|
||
`template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R1, [input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R2, class Pred = ranges::equal_to, class Proj1 = identity,
|
||
class Proj2 = identity>
|
||
requires ([forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<R1> || [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R1>) &&
|
||
([forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<R2> || [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R2>) &&
|
||
[indirectly_comparable](alg.req.ind.cmp#concept:indirectly_comparable "24.3.7.5 Concept indirectly_comparable [alg.req.ind.cmp]")<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
||
constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
|
||
Proj1 proj1 = {}, Proj2 proj2 = {});
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6138)
|
||
|
||
Let N1 be ranges::distance(r1) andN2 be ranges::distance(r2)[.](#5.sentence-1)
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6142)
|
||
|
||
*Returns*: false if N1 < N2, otherwise:ranges::equal(views::drop(ranges::ref_view(r1), N1 - static_cast<decltype(N1)>(N2)),
|
||
r2, pred, proj1, proj2)
|
||
|
||
[ð](#itemdecl:4)
|
||
|
||
`template<[execution-policy](algorithms.parallel.defns#concept:execution-policy "26.3.1 Preamble [algorithms.parallel.defns]") Ep, [sized-random-access-range](range.refinements#concept:sized-random-access-range "25.4.6 Other range refinements [range.refinements]") R1,
|
||
[sized-random-access-range](range.refinements#concept:sized-random-access-range "25.4.6 Other range refinements [range.refinements]") R2, class Pred = ranges::equal_to,
|
||
class Proj1 = identity, class Proj2 = identity>
|
||
requires [indirectly_comparable](alg.req.ind.cmp#concept:indirectly_comparable "24.3.7.5 Concept indirectly_comparable [alg.req.ind.cmp]")<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
||
bool ranges::ends_with(Ep&& exec, R1&& r1, R2&& r2,
|
||
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
||
`
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6161)
|
||
|
||
Let N1 be ranges::distance(r1) andN2 be ranges::distance(r2)[.](#7.sentence-1)
|
||
|
||
[8](#8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L6165)
|
||
|
||
*Returns*: false if N1 < N2, otherwise:ranges::equal(std::forward<Ep>(exec),
|
||
views::drop(ranges::ref_view(r1), N1 - static_cast<decltype(N1)>(N2)),
|
||
r2, pred, proj1, proj2)
|