Files
2025-10-25 03:02:53 +03:00

12 KiB
Raw Permalink Blame History

[special.mem.concepts]

26 Algorithms library [algorithms]

26.11 Specialized algorithms [specialized.algorithms]

26.11.2 Special memory concepts [special.mem.concepts]

1

#

Some algorithms in this subclause are constrained with the following exposition-only concepts:

🔗

template<class I> concept [nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]")<I> && is_lvalue_reference_v<iter_reference_t<I>> && [same_as](concept.same#concept:same_as "18.4.2Concept same_­as[concept.same]")<remove_cvref_t<iter_reference_t<I>>, iter_value_t<I>>;

2

#

A type I models nothrow-input-iterator only if no exceptions are thrown from increment, copy construction, move construction, copy assignment, move assignment, or indirection through valid iterators.

3

#

[Note 1:

This concept allows some input_iterator ([iterator.concept.input]) operations to throw exceptions.

— end note]

🔗

template<class S, class I> concept [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]") = [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<S, I>; // exposition only

4

#

Types S and I model nothrow-sentinel-for only if no exceptions are thrown from copy construction, move construction, copy assignment, move assignment, or comparisons between valid values of type I and S.

5

#

[Note 2:

This concept allows some sentinel_for ([iterator.concept.sentinel]) operations to throw exceptions.

— end note]

🔗

template<class S, class I> concept [nothrow-sized-sentinel-for](#concept:nothrow-sized-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<S, I> && [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8Concept sized_­sentinel_­for[iterator.concept.sizedsentinel]")<S, I>;

6

#

Types S and I model nothrow-sized-sentinel-for only if no exceptions are thrown from the - operator for valid values of type I and S.

7

#

[Note 3:

This concept allows some sized_sentinel_for ([iterator.concept.sizedsentinel]) operations to throw exceptions.

— end note]

🔗

template<class R> concept [nothrow-input-range](#concept:nothrow-input-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [range](range.range#concept:range "25.4.2Ranges[range.range]")<R> && [nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>> && [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<sentinel_t<R>, iterator_t<R>>;

8

#

A type R models nothrow-input-range only if no exceptions are thrown from calls to ranges::begin andranges::end on an object of type R.

🔗

template<class I> concept [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]")<I> && [forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11Concept forward_­iterator[iterator.concept.forward]")<I> && [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<I, I>;

9

#

[Note 4:

This concept allows some forward_iterator ([iterator.concept.forward]) operations to throw exceptions.

— end note]

🔗

template<class R> concept [nothrow-forward-range](#concept:nothrow-forward-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-input-range](#concept:nothrow-input-range "26.11.2Special memory concepts[special.mem.concepts]")<R> && [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>>;

🔗

template<class I> concept [nothrow-bidirectional-iterator](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]")<I> && [bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12Concept bidirectional_­iterator[iterator.concept.bidir]")<I>;

10

#

A type I models nothrow-bidirectional-iterator only if no exceptions are thrown from decrementing valid iterators.

[Note 5:

This concept allows some bidirectional_iterator ([iterator.concept.bidir]) operations to throw exceptions.

— end note]

🔗

template<class R> concept [nothrow-bidirectional-range](#concept:nothrow-bidirectional-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-forward-range](#concept:nothrow-forward-range "26.11.2Special memory concepts[special.mem.concepts]")<R> && [nothrow-bidirectional-iterator](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>>;

🔗

template<class I> concept [nothrow-random-access-iterator](#concept:nothrow-random-access-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-bidirectional-iterator](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]")<I> && [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13Concept random_­access_­iterator[iterator.concept.random.access]")<I> && [nothrow-sized-sentinel-for](#concept:nothrow-sized-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<I, I>;

11

#

A type I models nothrow-random-access-iterator only if no exceptions are thrown from comparisons of valid iterators, or the -, +, -=, +=, [] operators on valid values of type I and iter_difference_t.

[Note 6:

This concept allows some random_access_iterator ([iterator.concept.random.access]) operations to throw exceptions.

— end note]

🔗

`template concept nothrow-random-access-range = // exposition only nothrow-bidirectional-range && nothrow-random-access-iterator<iterator_t>;

template concept nothrow-sized-random-access-range = // exposition only nothrow-random-access-range && sized_range; `

12

#

A type R models nothrow-sized-random-access-range only if no exceptions are thrown from the call to ranges::size on an object of type R.