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,75 @@
[string.require]
# 27 Strings library [[strings]](./#strings)
## 27.4 String classes [[string.classes]](string.classes#string.require)
### 27.4.3 Class template basic_string [[basic.string]](basic.string#string.require)
#### 27.4.3.2 General requirements [string.require]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L2363)
If any operation would cause size() to
exceed max_size(), that operation throws an
exception object of type length_error[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L2368)
If any member function or operator of basic_string throws an exception, that
function or operator has no other effect on the basic_string object[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L2372)
Every object of typebasic_string<charT, traits, Allocator> uses an object of typeAllocator to allocate and free storage for the contained charT objects as needed[.](#3.sentence-1)
The Allocator object used is
obtained as described in [[container.reqmts]](container.reqmts "23.2.2.2Container requirements")[.](#3.sentence-2)
In every specialization basic_string<charT, traits, Allocator>,
the type traits shall meet
the character traits requirements ([[char.traits]](char.traits "27.2Character traits"))[.](#3.sentence-3)
[*Note [1](#note-1)*:
Every specialization basic_string<charT, traits, Allocator> is
an allocator-aware container ([[container.alloc.reqmts]](container.alloc.reqmts "23.2.2.5Allocator-aware containers")),
but does not use the allocator's construct and destroy member functions ([[container.requirements.pre]](container.requirements.pre "23.2.1Preamble"))[.](#3.sentence-4)
The program is ill-formed ifAllocator::value_type is not the same type as charT[.](#3.sentence-5)
— *end note*]
[*Note [2](#note-2)*:
The program is ill-formed if traits::char_type is not the same type as charT[.](#3.sentence-6)
— *end note*]
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L2394)
References, pointers, and iterators referring to the elements of abasic_string sequence may be
invalidated by the following uses of that basic_string object:
- [(4.1)](#4.1)
Passing as an argument to any standard library function taking a reference to non-constbasic_string as an argument[.](#4.1.sentence-1)[212](#footnote-212 "For example, as an argument to non-member functions swap() ([string.special]), operator>>() ([string.io]), and getline() ([string.io]), or as an argument to basic_­string::swap().")
- [(4.2)](#4.2)
Calling non-const member functions, exceptoperator[],at,data,front,back,begin,rbegin,end,
andrend[.](#4.2.sentence-1)
[212)](#footnote-212)[212)](#footnoteref-212)
For example, as an argument to non-member
functions swap() ([[string.special]](string.special "27.4.4.3swap")),operator>>() ([[string.io]](string.io "27.4.4.4Inserters and extractors")), and getline() ([[string.io]](string.io "27.4.4.4Inserters and extractors")), or as
an argument to basic_string::swap()[.](#footnote-212.sentence-1)