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

42
cppdraft/string/swap.md Normal file
View File

@@ -0,0 +1,42 @@
[string.swap]
# 27 Strings library [[strings]](./#strings)
## 27.4 String classes [[string.classes]](string.classes#string.swap)
### 27.4.3 Class template basic_string [[basic.string]](basic.string#string.swap)
#### 27.4.3.7 Modifiers [[string.modifiers]](string.modifiers#string.swap)
#### 27.4.3.7.8 basic_string::swap [string.swap]
[🔗](#lib:swap,basic_string)
`constexpr void swap(basic_string& s)
noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
allocator_traits<Allocator>::is_always_equal::value);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4263)
*Preconditions*: allocator_traits<Allocator>::propagate_on_container_swap::value is true orget_allocator() == s.get_allocator()[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4269)
*Postconditions*: *this contains the same sequence of characters that was in s,s contains the same sequence of characters that was in*this[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4276)
*Throws*: Nothing[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4280)
*Complexity*: Constant time[.](#4.sentence-1)