This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
[unreachable.sentinel]
# 24 Iterators library [[iterators]](./#iterators)
## 24.5 Iterator adaptors [[predef.iterators]](predef.iterators#unreachable.sentinel)
### 24.5.8 Unreachable sentinel [unreachable.sentinel]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6449)
Class unreachable_sentinel_t can be used with
any [weakly_incrementable](iterator.concept.winc#concept:weakly_incrementable "24.3.4.4Concept weakly_­incrementable[iterator.concept.winc]") type
to denote the “upper bound” of an unbounded interval[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6454)
[*Example [1](#example-1)*: char* p;// set p to point to a character buffer containing newlineschar* nl = find(p, unreachable_sentinel, '\n');
Provided a newline character really exists in the buffer, the use ofunreachable_sentinel above potentially makes the call to find more
efficient since the loop test against the sentinel does not require a
conditional branch[.](#2.sentence-1)
— *end example*]
[🔗](#lib:operator==,unreachable_sentinel_t)
namespace std {struct unreachable_sentinel_t {template<[weakly_incrementable](iterator.concept.winc#concept:weakly_incrementable "24.3.4.4Concept weakly_­incrementable[iterator.concept.winc]") I>friend constexpr bool operator==(unreachable_sentinel_t, const I&) noexcept{ return false; }};}