more reliable and accurate empty() checking in StreamRange

master
Daniel Kolesa 2015-06-29 18:54:25 +01:00
parent 41c0ac0fdd
commit b4146b0523
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ struct StreamRange<T, true>: InputRange<
StreamRange(const StreamRange &r): p_stream(r.p_stream), p_size(r.p_size) {} StreamRange(const StreamRange &r): p_stream(r.p_stream), p_size(r.p_size) {}
bool empty() const { bool empty() const {
return p_stream->tell() == p_size; return (p_size - p_stream->tell()) < StreamOffset(sizeof(T));
} }
bool pop_front() { bool pop_front() {