istreambuf_iterator::equal
2 の等価性のテストをストリーム バッファーの反復子を含めます。
bool equal(
const istreambuf_iterator<CharType, Traits>& _Right
) const;
パラメーター
- _Right
等価性を確認する反復子。
戻り値
istreambuf_iterator両方 s は終端のストリームの反復子である場合、またはどちらもシーケンス終端の反復子であるストリームのtrue ; それ false。
解説
範囲は、現在位置を最後のストリームの反復子への istreambuf_iterator で定義されますが、ストリームの反復子、終端のすべてが 等しい のメンバー関数には同じであるため、istreambuf_iterators.を使用してサブ範囲を定義することはできません。 == と != の演算子と同じ意味を持ちます。
使用例
// istreambuf_iterator_equal.cpp
// compile with: /EHsc
#include <iterator>
#include <iostream>
int main( )
{
using namespace std;
cout << "(Try the example: 'Hello world!'\n"
<< " then an Enter key to insert into the output,\n"
<< " & use a ctrl-Z Enter key combination to exit): ";
istreambuf_iterator<char> charReadIn1 ( cin );
istreambuf_iterator<char> charReadIn2 ( cin );
bool b1 = charReadIn1.equal ( charReadIn2 );
if (b1)
cout << "The iterators are equal." << endl;
else
cout << "The iterators are not equal." << endl;
}
Hello world!
FakePre-3272ed5829ea4db18b5e29bb796dcd79-9a852ccd83dd4b58a7753fcc8a0e4284
必要条件
ヘッダー: の <反復子>
名前空間: std