std::ostream_iterator<T,CharT,Traits>:: operator=
| Iterator concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator primitives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Algorithm concepts and utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Indirect callable concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Common algorithm requirements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
|
ostream_iterator::operator=
|
||||
|
ostream_iterator
&
operator
=
(
const
ostream_iterator
&
)
;
|
(1) | |
|
ostream_iterator
&
operator
=
(
const
T
&
value
)
;
|
(2) | |
out_stream
が関連付けられた
std::basic_ostream
へのポインタであり、
delim
がこのオブジェクトの構築時に指定されたデリミタである場合、効果は以下と同等です
*
out_stream
<<
value
;
if
(
delim
!
=
0
)
*
out_stream
<<
delim
;
return
*
this
;
目次 |
パラメータ
| value | - | 挿入するオブジェクト |
戻り値
* this
注記
T
はユーザー定義の
operator<<
を持つ任意のクラスにできます。
C++20より前では、コピー代入演算子の存在は 非推奨の暗黙的生成 に依存していました。
例
#include <iostream> #include <iterator> int main() { std::ostream_iterator<int> i1(std::cout, ", "); *i1++ = 1; // 標準的な形式、標準アルゴリズムで使用される *++i1 = 2; i1 = 3; // * も ++ も不要 std::ostream_iterator<double> i2(std::cout); i2 = 3.14; std::cout << '\n'; }
出力:
1, 2, 3, 3.14