std::swap(std::basic_string) (3) - Linux Manuals

std::swap(std::basic_string): std::swap(std::basic_string)

NAME

std::swap(std::basic_string) - std::swap(std::basic_string)

Synopsis


template< class CharT, class Traits, class Alloc >
void swap( std::basic_string<CharT, Traits, Alloc> &lhs, (until C++17)
std::basic_string<CharT, Traits, Alloc> &rhs );
template< class CharT, class Traits, class Alloc >
void swap( std::basic_string<CharT, Traits, Alloc> &lhs, (since C++17)
std::basic_string<CharT, Traits, Alloc> &rhs ) noexcept(/* see below */);


Specializes the std::swap algorithm for std::basic_string. Swaps the contents of lhs and rhs. Equivalent to lhs.swap(rhs).

Parameters


lhs, rhs - strings whose contents to swap

Return value


(none)

Complexity


Constant.

Exceptions


                                  (since C++17)
noexcept specification:
noexcept(noexcept(lhs.swap(rhs)))

See also


     swaps the contents
swap (public member function)