Files
cppdraft_translate/cppdraft/alg/starts/with.md
2025-10-25 03:02:53 +03:00

4.4 KiB
Raw Blame History

[alg.starts.with]

26 Algorithms library [algorithms]

26.6 Non-modifying sequence operations [alg.nonmodifying]

26.6.16 Starts with [alg.starts.with]

🔗

template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") I1, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<I1> S1, [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") I2, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<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.5Concept indirectly_­comparable[alg.req.ind.cmp]")<I1, I2, Pred, Proj1, Proj2> constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template<[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") R1, [input_range](range.refinements#concept:input_range "25.4.6Other 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.5Concept indirectly_­comparable[alg.req.ind.cmp]")<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});

1

#

Returns: ranges::mismatch(std::move(first1), last1, std::move(first2), last2, pred, proj1, proj2).in2 == last2

🔗

template<[execution-policy](algorithms.parallel.defns#concept:execution-policy "26.3.1Preamble[algorithms.parallel.defns]") Ep, [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13Concept random_­access_­iterator[iterator.concept.random.access]") I1, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8Concept sized_­sentinel_­for[iterator.concept.sizedsentinel]")<I1> S1, [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13Concept random_­access_­iterator[iterator.concept.random.access]") I2, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8Concept 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.5Concept indirectly_­comparable[alg.req.ind.cmp]")<I1, I2, Pred, Proj1, Proj2> bool ranges::starts_with(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template<[execution-policy](algorithms.parallel.defns#concept:execution-policy "26.3.1Preamble[algorithms.parallel.defns]") Ep, [sized-random-access-range](range.refinements#concept:sized-random-access-range "25.4.6Other range refinements[range.refinements]") R1, [sized-random-access-range](range.refinements#concept:sized-random-access-range "25.4.6Other 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.5Concept indirectly_­comparable[alg.req.ind.cmp]")<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> bool ranges::starts_with(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});

2

#

Returns: ranges::mismatch(std::forward(exec), std::move(first1), last1, std::move(first2), last2, pred, proj1, proj2).in2 == last2