名前空間
変種
操作

std::basic_istream<CharT,Traits>::operator=

提供: cppreference.com
< cpp‎ | io‎ | basic istream
 
 
 
 
protected:
basic_istream& operator=(const basic_istream& rhs )= delete;
(1)
protected:
basic_istream& operator=( basic_istream&& rhs );
(2) (C++11以上)

1) コピー代入演算子は protected であり、削除されています。 入力ストリームはコピー可能ではありません。

2) ムーブ代入演算子は、 swap(*rhs) を呼んだかのように、 gcount() の値と、 rdbuf() を除いた基底クラスのすべてのデータメンバを、 rhs と交換します。 このムーブ代入演算子は protected です。 紐付けられているストリームバッファを正しくムーブ代入する方法を知っているムーブ可能な派生入力ストリームクラス std::basic_ifstream および std::basic_istringstream のムーブ代入演算子によってのみ呼ばれます。

[編集]引数

rhs - *this に代入する basic_istream オブジェクト

[編集]

#include <sstream>#include <iostream>   int main(){std::istringstream s1; s1 =std::istringstream("test");// OK   std::cin=std::istringstream("test");// ERROR: 'operator=' is protected}


close