namespace std {
template<class CharT, class Traits, class Allocator>
void swap(basic_istringstream<CharT, Traits, Allocator>& x,
basic_istringstream<CharT, Traits, Allocator>& y);
}
概要
2つのbasic_istringstreamオブジェクトを入れ替える。
効果
x.swap(y)
例
#include <iostream>
#include <sstream>
#include <string>
int main()
{
std::istringstream ss1("first");
std::istringstream ss2("second");
std::swap(ss1, ss2);
std::string s1, s2;
ss1 >> s1;
ss2 >> s2;
std::cout << s1 << std::endl;
std::cout << s2 << std::endl;
}
出力
second
first
バージョン
言語
- C++11
処理系
- Clang: 3.0 ✅
- GCC: 5.1.0 ✅
- ICC: ??
- Visual C++: ??