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

211 lines
12 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[special.mem.concepts]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.11 Specialized <memory> algorithms [[specialized.algorithms]](specialized.algorithms#special.mem.concepts)
### 26.11.2 Special memory concepts [special.mem.concepts]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13543)
Some algorithms in this subclause are constrained with the following
exposition-only concepts:
[🔗](#concept:nothrow-input-iterator)
`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](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13555)
A type I models [*nothrow-input-iterator*](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]") only if
no exceptions are thrown from increment,
copy construction, move construction,
copy assignment, move assignment,
or indirection through valid iterators[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13562)
[*Note [1](#note-1)*:
This concept allows some [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") ([[iterator.concept.input]](iterator.concept.input "24.3.4.9Concept input_­iterator"))
operations to throw exceptions[.](#3.sentence-1)
— *end note*]
[🔗](#concept:nothrow-sentinel-for)
`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](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13575)
Types S and I model [*nothrow-sentinel-for*](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]") 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[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13581)
[*Note [2](#note-2)*:
This concept allows some [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]") ([[iterator.concept.sentinel]](iterator.concept.sentinel "24.3.4.7Concept sentinel_­for"))
operations to throw exceptions[.](#5.sentence-1)
— *end note*]
[🔗](#concept:nothrow-sized-sentinel-for)
`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](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13596)
Types S and I model [*nothrow-sized-sentinel-for*](#concept:nothrow-sized-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]") only if no exceptions are thrown from the - operator
for valid values of type I and S[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13601)
[*Note [3](#note-3)*:
This concept allows some [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8Concept sized_­sentinel_­for[iterator.concept.sizedsentinel]") ([[iterator.concept.sizedsentinel]](iterator.concept.sizedsentinel "24.3.4.8Concept sized_­sentinel_­for"))
operations to throw exceptions[.](#7.sentence-1)
— *end note*]
[🔗](#concept:nothrow-input-range)
`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](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13617)
A type R models [*nothrow-input-range*](#concept:nothrow-input-range "26.11.2Special memory concepts[special.mem.concepts]") only if
no exceptions are thrown from calls to ranges::begin andranges::end on an object of type R[.](#8.sentence-1)
[🔗](#concept:nothrow-forward-iterator)
`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](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13632)
[*Note [4](#note-4)*:
This concept allows some [forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11Concept forward_­iterator[iterator.concept.forward]") ([[iterator.concept.forward]](iterator.concept.forward "24.3.4.11Concept forward_­iterator"))
operations to throw exceptions[.](#9.sentence-1)
— *end note*]
[🔗](#concept:nothrow-forward-range)
`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>>;
`
[🔗](#concept:nothrow-bidirectional-iterator)
`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](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13654)
A type I models [*nothrow-bidirectional-iterator*](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]") only if no exceptions are thrown from decrementing valid iterators[.](#10.sentence-1)
[*Note [5](#note-5)*:
This concept allows some [bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12Concept bidirectional_­iterator[iterator.concept.bidir]") ([[iterator.concept.bidir]](iterator.concept.bidir "24.3.4.12Concept bidirectional_­iterator"))
operations to throw exceptions[.](#10.sentence-2)
— *end note*]
[🔗](#concept:nothrow-bidirectional-range)
`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>>;
`
[🔗](#concept:nothrow-random-access-iterator)
`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](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13679)
A type I models [*nothrow-random-access-iterator*](#concept:nothrow-random-access-iterator "26.11.2Special memory concepts[special.mem.concepts]") only if no exceptions are thrown from comparisons of valid iterators,
or the -, +, -=, +=, [] operators
on valid values of type I and iter_difference_t<I>[.](#11.sentence-1)
[*Note [6](#note-6)*:
This concept allows some [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13Concept random_­access_­iterator[iterator.concept.random.access]") ([[iterator.concept.random.access]](iterator.concept.random.access "24.3.4.13Concept random_­access_­iterator"))
operations to throw exceptions[.](#11.sentence-2)
— *end note*]
[🔗](#itemdecl:10)
`template<class R>
concept [nothrow-random-access-range](#concept:nothrow-random-access-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only
[nothrow-bidirectional-range](#concept:nothrow-bidirectional-range "26.11.2Special memory concepts[special.mem.concepts]")<R> &&
[nothrow-random-access-iterator](#concept:nothrow-random-access-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>>;
template<class R>
concept [nothrow-sized-random-access-range](#concept:nothrow-sized-random-access-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only
[nothrow-random-access-range](#concept:nothrow-random-access-range "26.11.2Special memory concepts[special.mem.concepts]")<R> && [sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R>;
`
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13702)
A type R models [*nothrow-sized-random-access-range*](#concept:nothrow-sized-random-access-range "26.11.2Special memory concepts[special.mem.concepts]") only if no exceptions are thrown from the call to ranges::size on an object of type R[.](#12.sentence-1)