[string.swap]
27 Strings library [strings]
27.4 String classes [string.classes]
27.4.3 Class template basic_string [basic.string]
27.4.3.7 Modifiers [string.modifiers]
27.4.3.7.8 basic_string::swap [string.swap]
constexpr void swap(basic_string& s)
noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
allocator_traits<Allocator>::is_always_equal::value);
Preconditions: allocator_traits<Allocator>::propagate_on_container_swap::value is true or get_allocator() == s.get_allocator().
Postconditions: *this contains the same sequence of characters that was in s, s contains the same sequence of characters that was in *this.
Complexity: Constant time.