std::istreambuf_iterator
提供:cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <iterator>
|
||
| template< class CharT, class Traits = std::char_traits<CharT> > class istreambuf_iterator : public std::iterator< std::input_iterator_tag, |
||
std::istreambuf_iteratorそれを構成しているためstd::basic_streambufオブジェクトから連続した文字列を読み込み、シングルパスの入力イテレータです。イテレータがインクリメントされたときに、それが間接参照されたときに実際の読み取り操作はなく、実行されます。イテレータが構築されるか、最初の逆参照が行われたときの最初の文字を読み取ることができます。それ以外の場合、間接参照すると、ほとんどの最近読んだ文字のコピーを返します。.Original:
std::istreambuf_iterator is a single-pass input iterator that reads successive characters from the std::basic_streambuf object for which it was constructed. The actual read operation is performed when the iterator is incremented, not when it is dereferenced. The first character may be read when the iterator is constructed or when the first dereferencing is done. Otherwise, dereferencing only returns a copy of the most recently read 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.
デフォルト構築
std::istreambuf_iteratorはエンドオブストリームイテレータとして知られています。有効なstd::istreambuf_iterator基になるストリームの終わりに達すると、それはエンド·オブ·ストリーム反復子と等しくなる。さらにそれを間接参照またはインクリメントすると、未定義の動作を呼び出す.Original:
The default-constructed
std::istreambuf_iterator is known as the end-of-stream iterator. When a valid std::istreambuf_iterator reaches the end of the underlying stream, it becomes equal to the end-of-stream iterator. Dereferencing or incrementing it further invokes undefined behavior.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::istreambuf_iteratorささいなコピーコンストラクタ、constexprのデフォルトコンストラクタ、些細なデストラクタを持つ.Original:
std::istreambuf_iterator has a trivial copy constructor, a constexpr default constructor, and a trivial destructor.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
|
int_type
|
typename traits::int_type |
streambuf_type
|
std::basic_streambuf<CharT, Traits> |
istream_type
|
std::basic_istream<CharT, Traits> |
| This section is incomplete Reason: the proxy member type |
[編集] メンバ関数
| 新しいistreambuf_iteratorを構築します Original: constructs a new istreambuf_iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
| (destructor) (暗黙的に宣言された) |
destructs an istreambuf_iterator (パブリックメンバ関数) |
| (C + + 11以来) |
はメンバーを持っている場合は、現在のコピーは、現在の文字のメンバーcharacter CharTaccesses取得します Original: obtains a copy of the current character accesses a member of the current character, if CharT has members The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |
| 進歩istreambuf_iterator Original: advances the istreambuf_iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
| テストの両方istreambuf_iteratorsがエンドオブストリームである場合、またはその両方が有効な場合 Original: tests if both istreambuf_iterators are end-of-stream or if both are valid The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
[編集] 非メンバ関数
| 2 istreambuf_iteratorsを比較します Original: compares two istreambuf_iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
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
|
CharT |
difference_type
|
Traits::off_type |
pointer
|
/* unspecified, usually CharT* */ |
reference
|
CharT |
iterator_category
|
std::input_iterator_tag |
[編集] 例
#include <vector> #include <sstream> #include <iostream> #include <iterator> int main() { // typical use case: an input stream represented as a pair of iterators std::istringstream in("Hello, world"); std::vector<char> v( (std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>() ); std::cout << "v has " << v.size() << " bytes. "; v.push_back('\0'); std::cout << "it holds \"" << &v[0] << "\"\n"; // demonstration of the single-pass nature std::istringstream s("abc"); std::istreambuf_iterator<char> i1(s), i2(s); std::cout << "i1 returns " << *i1 << '\n' << "i2 returns " << *i2 << '\n'; ++i1; std::cout << "after incrementing i1, but not i2\n" << "i1 returns " << *i1 << '\n' << "i2 returns " << *i2 << '\n'; ++i2; // this makes the apparent value of *i2 to jump from 'a' to 'c' std::cout << "after incrementing i2, but not i1\n" << "i1 returns " << *i1 << '\n' << "i2 returns " << *i2 << '\n'; }
Output:
v has 12 bytes. it holds "Hello, world" i1 returns a i2 returns a after incrementing i1, but not i2 i1 returns b i2 returns a after incrementing i2, but not i1 i1 returns b i2 returns c
[編集] も参照してください
| 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. (クラステンプレート) | |