43 lines
1.4 KiB
Markdown
43 lines
1.4 KiB
Markdown
[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)
|