From b4146b052329934f0387f17288d5b2de3c366aa1 Mon Sep 17 00:00:00 2001 From: q66 Date: Mon, 29 Jun 2015 18:54:25 +0100 Subject: [PATCH] more reliable and accurate empty() checking in StreamRange --- octa/stream.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octa/stream.hh b/octa/stream.hh index e02a603..b02ab1a 100644 --- a/octa/stream.hh +++ b/octa/stream.hh @@ -68,7 +68,7 @@ struct StreamRange: InputRange< StreamRange(const StreamRange &r): p_stream(r.p_stream), p_size(r.p_size) {} bool empty() const { - return p_stream->tell() == p_size; + return (p_size - p_stream->tell()) < StreamOffset(sizeof(T)); } bool pop_front() {