The Wayback Machine - https://web.archive.org/web/20180527123438/http://ja.cppreference.com:80/w/cpp/string/basic_string/swap2
名前空間
変種
操作

std::swap(std::basic_string)

提供: cppreference.com
< cpp‎ | string‎ | basic string
 
 
 
std::basic_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およびそれ以降)

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

目次

[編集]引数

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

[編集]戻り値

(なし)

[編集]計算量

一定。

例外

noexcept 指定:  
noexcept(noexcept(lhs.swap(rhs)))
(C++17およびそれ以降)

[編集]関連項目

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