21 Strings library [strings]

21.3 String classes [string.classes]

21.3.1 Class template basic_string [basic.string]

21.3.1.6 basic_string modifiers [string.modifiers]

21.3.1.6.8 basic_string::swap [string.swap]

void swap(basic_string& s) noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value || allocator_traits<Allocator>::is_always_equal::value);

Postconditions: *this contains the same sequence of characters that was in s, s contains the same sequence of characters that was in *this.

Throws: Nothing.

Complexity: Constant time.