|
1131 | 1131 | constexpr ForwardIterator
|
1132 | 1132 | search(ForwardIterator first, ForwardIterator last, const Searcher& searcher);
|
1133 | 1133 |
|
| 1134 | + namespace ranges { |
| 1135 | + // \ref{alg.starts.with}, starts with |
| 1136 | + template<@\libconcept{input_iterator}@ I1, @\libconcept{sentinel_for}@<I1> S1, @\libconcept{input_iterator}@ I2, @\libconcept{sentinel_for}@<I2> S2, |
| 1137 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 1138 | + requires @\libconcept{indirectly_comparable}@<I1, I2, Pred, Proj1, Proj2> |
| 1139 | + constexpr bool starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 1140 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 1141 | + template<@\libconcept{input_range}@ R1, @\libconcept{input_range}@ R2, class Pred = ranges::equal_to, |
| 1142 | + class Proj1 = identity, class Proj2 = identity> |
| 1143 | + requires @\libconcept{indirectly_comparable}@<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 1144 | + constexpr bool starts_with(R1&& r1, R2&& r2, Pred pred = {}, |
| 1145 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 1146 | + |
| 1147 | + // \ref{alg.ends.with}, ends with |
| 1148 | + template<@\libconcept{input_iterator}@ I1, @\libconcept{sentinel_for}@<I1> S1, @\libconcept{input_iterator}@ I2, @\libconcept{sentinel_for}@<I2> S2, |
| 1149 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 1150 | + requires (@\libconcept{forward_iterator}@<I1> || @\libconcept{sized_sentinel_for}@<S1, I1>) && |
| 1151 | + (@\libconcept{forward_iterator}@<I2> || @\libconcept{sized_sentinel_for}@<S2, I2>) && |
| 1152 | + @\libconcept{indirectly_comparable}@<I1, I2, Pred, Proj1, Proj2> |
| 1153 | + constexpr bool ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 1154 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 1155 | + template<@\libconcept{input_range}@ R1, @\libconcept{input_range}@ R2, class Pred = ranges::equal_to, |
| 1156 | + class Proj1 = identity, class Proj2 = identity> |
| 1157 | + requires (@\libconcept{forward_range}@<R1> || @\libconcept{sized_range}@<R1>) && |
| 1158 | + (@\libconcept{forward_range}@<R2> || @\libconcept{sized_range}@<R2>) && |
| 1159 | + @\libconcept{indirectly_comparable}@<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 1160 | + constexpr bool ends_with(R1&& r1, R2&& r2, Pred pred = {}, |
| 1161 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 1162 | + } |
| 1163 | + |
1134 | 1164 | // \ref{alg.modifying.operations}, mutating sequence operations
|
1135 | 1165 | // \ref{alg.copy}, copy
|
1136 | 1166 | template<class InputIterator, class OutputIterator>
|
|
4219 | 4249 | \tcode{Searcher} need not meet the \oldconcept{CopyConstructible} requirements.
|
4220 | 4250 | \end{itemdescr}
|
4221 | 4251 |
|
| 4252 | +\rSec2[alg.starts.with]{Starts with} |
| 4253 | + |
| 4254 | +\indexlibraryglobal{starts_with}% |
| 4255 | +\begin{itemdecl} |
| 4256 | +template<@\libconcept{input_iterator}@ I1, @\libconcept{sentinel_for}@<I1> S1, @\libconcept{input_iterator}@ I2, @\libconcept{sentinel_for}@<I2> S2, |
| 4257 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 4258 | + requires @\libconcept{indirectly_comparable}@<I1, I2, Pred, Proj1, Proj2> |
| 4259 | + constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 4260 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 4261 | +template<@\libconcept{input_range}@ R1, @\libconcept{input_range}@ R2, class Pred = ranges::equal_to, class Proj1 = identity, |
| 4262 | + class Proj2 = identity> |
| 4263 | + requires @\libconcept{indirectly_comparable}@<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 4264 | + constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {}, |
| 4265 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 4266 | +\end{itemdecl} |
| 4267 | + |
| 4268 | +\begin{itemdescr} |
| 4269 | +\pnum |
| 4270 | +\returns |
| 4271 | +\begin{codeblock} |
| 4272 | +ranges::mismatch(std::move(first1), last1, std::move(first2), last2, |
| 4273 | + pred, proj1, proj2).in2 == last2 |
| 4274 | +\end{codeblock} |
| 4275 | +\end{itemdescr} |
| 4276 | + |
| 4277 | +\rSec2[alg.ends.with]{Ends with} |
| 4278 | + |
| 4279 | +\indexlibraryglobal{ends_with}% |
| 4280 | +\begin{itemdecl} |
| 4281 | +template<@\libconcept{input_iterator}@ I1, @\libconcept{sentinel_for}@<I1> S1, @\libconcept{input_iterator}@ I2, @\libconcept{sentinel_for}@<I2> S2, |
| 4282 | + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 4283 | + requires (@\libconcept{forward_iterator}@<I1> || @\libconcept{sized_sentinel_for}@<S1, I1>) && |
| 4284 | + (@\libconcept{forward_iterator}@<I2> || @\libconcept{sized_sentinel_for}@<S2, I2>) && |
| 4285 | + @\libconcept{indirectly_comparable}@<I1, I2, Pred, Proj1, Proj2> |
| 4286 | + constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 4287 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 4288 | +\end{itemdecl} |
| 4289 | + |
| 4290 | +\begin{itemdescr} |
| 4291 | +\pnum |
| 4292 | +Let \tcode{N1} be \tcode{last1 - first1} and |
| 4293 | +\tcode{N2} be \tcode{last2 - first2}. |
| 4294 | + |
| 4295 | +\pnum |
| 4296 | +\returns |
| 4297 | +\tcode{false} if $\tcode{N1} < \tcode{N2}$, otherwise |
| 4298 | +\begin{codeblock} |
| 4299 | +ranges::equal(std::move(first1) + (N1 - N2), last1, std::move(first2), last2, |
| 4300 | + pred, proj1, proj2) |
| 4301 | +\end{codeblock} |
| 4302 | +\end{itemdescr} |
| 4303 | + |
| 4304 | +\begin{itemdecl} |
| 4305 | +template<@\libconcept{input_range}@ R1, @\libconcept{input_range}@ R2, class Pred = ranges::equal_to, class Proj1 = identity, |
| 4306 | + class Proj2 = identity> |
| 4307 | + requires (@\libconcept{forward_range}@<R1> || @\libconcept{sized_range}@<R1>) && |
| 4308 | + (@\libconcept{forward_range}@<R2> || @\libconcept{sized_range}@<R2>) && |
| 4309 | + @\libconcept{indirectly_comparable}@<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 4310 | + constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {}, |
| 4311 | + Proj1 proj1 = {}, Proj2 proj2 = {}); |
| 4312 | +\end{itemdecl} |
| 4313 | + |
| 4314 | +\begin{itemdescr} |
| 4315 | +\pnum |
| 4316 | +Let \tcode{N1} be \tcode{ranges::distance(r1)} and |
| 4317 | +\tcode{N2} be \tcode{ranges::distance(r2)}. |
| 4318 | + |
| 4319 | +\pnum |
| 4320 | +\returns |
| 4321 | +\tcode{false} if $\tcode{N1} < \tcode{N2}$, otherwise |
| 4322 | +\begin{codeblock} |
| 4323 | +ranges::equal(ranges::drop_view(ranges::ref_view(r1), N1 - N2), r2, pred, proj1, proj2) |
| 4324 | +\end{codeblock} |
| 4325 | +\end{itemdescr} |
| 4326 | + |
4222 | 4327 | \rSec1[alg.modifying.operations]{Mutating sequence operations}
|
4223 | 4328 |
|
4224 | 4329 | \rSec2[alg.copy]{Copy}
|
|
0 commit comments