测试两种等效的输入流缓冲区之间迭代器。
bool equal(
const istreambuf_iterator<CharType, Traits>& _Right
) const;
参数
- _Right
迭代器可以检查字符串是否相等。
返回值
true,则两个 istreambuf_iterator) 是流结束迭代器,或者没有为流结束迭代器;为 false。
备注
范围由对当前位置和关闭流迭代器的 istreambuf_iterator 定义,但是,非,因为所有结束流迭代器是等效的。equal 成员函数下,定义所有 subranges 使用 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-ece0239b369d47149de1bd2e7552f7f8-d953b423e8024ef68a90fb1ef917741b
要求
头文件: <iterator>
命名空间: std