Can someone please explain why this istream_iterator code.
// code extract from SGI STL istream_iterator class
bool _M_equal(const istream_iterator& __x) const {
return (_M_ok == __x.M_ok) && (!_M_ok || _M_stream == __x._M_stream);
}
works and is not just written as
bool _M_equal(const istream_iterator& __x) const {
return (_M_ok == __x.M_ok) && (_M_stream == __x._M_stream);
}
I don't understanding the reason for including !_M_ok. Thanks in advance.
_M_stream == __x._M_stream
具有未定义的行为,如果_M_ok
或__x._M_ok
为false。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.