Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tests for equivalence between two input stream buffer iterators.
bool equal(
const istreambuf_iterator<CharType, Traits>& _Right
) const;
Parameters
- _Right
The iterator for which to check for equality.
Return Value
true if both istreambuf_iterators are end-of-stream iterators or if neither is an end-of-stream iterator; otherwise false.
Remarks
A range is defined by the istreambuf_iterator to the current position and the end-of-stream iterator, but since all non-end-of stream iterators are equivalent under the equal member function, it is not possible to define any subranges using istreambuf_iterators. The == and != operators have the same semantics.
Example
// 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-7804be8bcb9f4aab88bfaa0598017bfa-35dcb0e3cc904ee48febe557973b1f47
Requirements
Header: <iterator>
Namespace: std