Defined in header <iterator> | ||
---|---|---|
template< class T, class CharT, class Traits, class Dist > bool operator==( const std::istream_iterator<T, CharT, Traits, Dist>& lhs, const std::istream_iterator<T, CharT, Traits, Dist>& rhs ); | (1) | |
template< class T, class CharT, class Traits, class Dist > bool operator!=( const std::istream_iterator<T, CharT, Traits, Dist>& lhs, const std::istream_iterator<T, CharT, Traits, Dist>& rhs ); | (2) | (until C++20) |
friend bool operator==( const istream_iterator& i, std::default_sentinel_t ); | (3) | (since C++20) |
Checks whether both lhs
and rhs
are equal. Two stream iterators are equal if both of them are end-of-stream iterators or both of them refer to the same stream.
lhs
is equal to rhs
.lhs
is not equal to rhs
.lhs
is an end-of-stream iterator.std::istream_iterator<T, CharT, Traits, Dist>
is an associated class of the arguments. The | (since C++20) |
lhs, rhs | - | stream iterators to compare |
true
if lhs
is equal to rhs
, false
otherwise.true
if lhs
is not equal to rhs
, false
otherwise.true
if lhs
is an end-of-stream iterator, false
otherwise.May throw implementation-defined exceptions.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 261 | C++98 | the description of operator!= was missing | added |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/iterator/istream_iterator/operator_cmp