std::ostream_iterator
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <iterator>
|
||
template< class T, class CharT = char, |
||
std::ostream_iterator
T
を使用して、それを構成しているためstd::basic_ostreamオブジェクトにタイプoperator<<
の連続するオブジェクトを書き込む単一パスの出力イテレータです。任意の区切り文字列は、すべての書き込み操作の後に出力ストリームに書き込まれます。イテレータは(間接参照か否かにかかわらず)に割り当てられている場合、書き込み操作が実行されます。 std::ostream_iterator
をインクリメントすると、操作は行われません.Original:
std::ostream_iterator
is a single-pass output iterator that writes successive objects of type T
into the std::basic_ostream object for which it was constructed, using operator<<
. Optional delimiter string is written to the output stream after every write operation. The write operation is performed when the iterator (whether dereferenced or not) is assigned to. Incrementing the std::ostream_iterator
is a no-op.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
典型的な実装では、
std::ostream_iterator
の唯一のデータメンバは、関連std::basic_ostream
と区切りの文字列の最初の文字へのポインタへのポインタです.Original:
In a typical implementation, the only data members of
std::ostream_iterator
are a pointer to the associated std::basic_ostream
and a pointer to the first character in the delimiter string.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
それは文字ごとに一度監視オブジェクトを構築し、破壊のオーバーヘッドを回避できますので、文字を書くとき、std::ostreambuf_iteratorは、より効率的である.
Original:
When writing characters, std::ostreambuf_iterator is more efficient, since it avoids the overhead of constructing and destructing the sentry object once per character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] メンバータイプ
メンバー·タイプ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
char_type
|
CharT
|
traits_type
|
Traits
|
ostream_type
|
std::basic_ostream<CharT, Traits> |
[編集] メンバ関数
新しいostream_iteratorを構築します Original: constructs a new ostream_iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
ostream_iteratorを破棄します Original: destructs an ostream_iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
関連する出力配列にオブジェクトが書き込まれます Original: writes a object to the associated output sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
no-op (パブリックメンバ関数) | |
no-op (パブリックメンバ関数) |
Inherited from std::iterator
Member types
メンバー·タイプ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
void |
difference_type
|
void |
pointer
|
void |
reference
|
void |
iterator_category
|
std::output_iterator_tag |
[編集] 例
このコードを実行します
#include <iostream> #include <sstream> #include <iterator> #include <algorithm> int main() { std::istringstream str("0.1 0.2 0.3 0.4"); std::partial_sum( std::istream_iterator<double>(str), std::istream_iterator<double>(), std::ostream_iterator<double>(std::cout, " ")); }
出力:
0.1 0.3 0.6 1
[編集] も参照してください
std::basic_streambufに書き込みを行う出力イテレータ Original: output iterator that writes to std::basic_streambuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) | |
std::basic_istreamから読み取る入力イテレータ Original: input iterator that reads from std::basic_istream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |