|
695 | 695 | constexpr bool none_of(R&& r, Pred pred, Proj proj = {});
|
696 | 696 | }
|
697 | 697 |
|
| 698 | + // \ref{alg.contains}, contains |
| 699 | + namespace ranges { |
| 700 | + template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class T, class Proj = identity> |
| 701 | + requires @\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T*> |
| 702 | + constexpr bool contains(I first, S last, const T& value, Proj proj = {}); |
| 703 | + template<@\libconcept{input_range}@ R, class T, class Proj = identity> |
| 704 | + requires |
| 705 | + @\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 706 | + constexpr bool contains(R&& r, const T& value, Proj proj = {}); |
| 707 | + |
| 708 | + template<@\libconcept{forward_iterator}@ I1, @\libconcept{sentinel_for}@<I1> S1, |
| 709 | + @\libconcept{forward_iterator}@ I2, @\libconcept{sentinel_for}@<I2> S2, |
| 710 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 711 | + requires @\libconcept{indirectly_comparable}@<I1, I2, Pred, Proj1, Proj2> |
| 712 | + constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2, |
| 713 | + Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 714 | + template<@\libconcept{forward_range}@ R1, @\libconcept{forward_range}@ R2, |
| 715 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 716 | + requires @\libconcept{indirectly_comparable}@<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 717 | + constexpr bool contains_subrange(R1&& r1, R2&& r2, |
| 718 | + Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 719 | + } |
| 720 | + |
698 | 721 | // \ref{alg.foreach}, for each
|
699 | 722 | template<class InputIterator, class Function>
|
700 | 723 | constexpr Function for_each(InputIterator first, InputIterator last, Function f);
|
|
3223 | 3246 | At most \tcode{last - first} applications of the predicate and any projection.
|
3224 | 3247 | \end{itemdescr}
|
3225 | 3248 |
|
| 3249 | +\rSec2[alg.contains]{Contains} |
| 3250 | + |
| 3251 | +\indexlibraryglobal{contains}% |
| 3252 | +\begin{itemdecl} |
| 3253 | +template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class T, class Proj = identity> |
| 3254 | + requires @\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T*> |
| 3255 | + constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); |
| 3256 | +template<@\libconcept{input_range}@ R, class T, class Proj = identity> |
| 3257 | + requires @\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 3258 | + constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); |
| 3259 | +\end{itemdecl} |
| 3260 | + |
| 3261 | +\begin{itemdescr} |
| 3262 | +\pnum |
| 3263 | +\returns |
| 3264 | +\tcode{ranges::find(std::move(first), last, value, proj) != last}. |
| 3265 | +\end{itemdescr} |
| 3266 | + |
| 3267 | +\indexlibraryglobal{contains_subrange}% |
| 3268 | +\begin{itemdecl} |
| 3269 | +template<@\libconcept{forward_iterator}@ I1, @\libconcept{sentinel_for}@<I1> S1, |
| 3270 | + @\libconcept{forward_iterator}@ I2, @\libconcept{sentinel_for}@<I2> S2, |
| 3271 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 3272 | + requires @\libconcept{indirectly_comparable}@<I1, I2, Pred, Proj1, Proj2> |
| 3273 | + constexpr bool ranges::contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2, |
| 3274 | + Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 3275 | +template<@\libconcept{forward_range}@ R1, @\libconcept{forward_range}@ R2, |
| 3276 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 3277 | + requires @\libconcept{indirectly_comparable}@<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 3278 | + constexpr bool ranges::contains_subrange(R1&& r1, R2&& r2, Pred pred = {}, |
| 3279 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 3280 | +\end{itemdecl} |
| 3281 | + |
| 3282 | +\begin{itemdescr} |
| 3283 | +\pnum |
| 3284 | +\returns |
| 3285 | +\tcode{first2 == last2 || !ranges::search(first1, last1, first2, last2, pred, proj1, proj2).empty()}. |
| 3286 | +\end{itemdescr} |
| 3287 | + |
3226 | 3288 | \rSec2[alg.foreach]{For each}
|
3227 | 3289 |
|
3228 | 3290 | \indexlibraryglobal{for_each}%
|
|
0 commit comments