名前空間
変種

std::swap(std::basic_string)

提供: cppreference.com
 
 
 
std::basic_string
 
<tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody>
ヘッダ <string> で定義
template< class CharT, class Traits, class Alloc > void swap( std::basic_string<CharT, Traits, Alloc> &lhs, std::basic_string<CharT, Traits, Alloc> &rhs );
(C++17未満)
template< class CharT, class Traits, class Alloc > void swap( std::basic_string<CharT, Traits, Alloc> &lhs, std::basic_string<CharT, Traits, Alloc> &rhs ) noexcept(/* see below */);
(C++17以上)
(C++20未満)
template< class CharT, class Traits, class Alloc > constexpr void swap( std::basic_string<CharT, Traits, Alloc> &lhs, std::basic_string<CharT, Traits, Alloc> &rhs ) noexcept(/* see below */);
(C++20以上)

std::swap アルゴリズムを std::basic_string に対して特殊化します。 lhsrhs の内容を入れ替えます。 lhs.swap(rhs) と同等です。

引数

lhs, rhs - 内容を入れ替える文字列

戻り値

(なし)

計算量

一定。

例外

noexcept 指定:  
noexcept(noexcept(lhs.swap(rhs)))
(C++17以上)

関連項目

内容を入れ替えます
(パブリックメンバ関数) [edit]