24 Strings library [strings]

24.3 String classes [string.classes]

24.3.2 Class template basic_­string [basic.string]

24.3.2.6 basic_­string modifiers [string.modifiers]

24.3.2.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.