istreambuf_iterator::equal
等價測試在兩個輸入資料流緩衝區 Iterator 之間。
bool equal(
const istreambuf_iterator<CharType, Traits>& _Right
) const;
參數
- _Right
Iterator 可以檢查是否相等。
傳回值
true ,如果兩個 istreambuf_iterator是關閉資料流 Iterator,或者都不是關閉資料流 Iterator;否則 false。
備註
範圍是由目前位置和關閉資料流 Iterator 的 istreambuf_iterator ,定義,但是,因為所有非關閉資料流 Iterator 相等。 equal 成員函式中,定義所有範圍使用 istreambuf_iterator.,是不可能的。 == 和 != 運算子具有相同的語意。
範例
// 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-0c86894b262d476db8fc0376867ee9cd-5fb6ad80097143b7860090e4c124a2a9
需求
標頭:<迭代器>
命名空間: std