From 740914d772c6060391baea41a8dc8869869bb265 Mon Sep 17 00:00:00 2001 From: q66 Date: Mon, 27 Feb 2017 17:55:05 +0100 Subject: [PATCH] copy the item too --- ostd/stream.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ostd/stream.hh b/ostd/stream.hh index 6006786..c51c630 100644 --- a/ostd/stream.hh +++ b/ostd/stream.hh @@ -159,7 +159,9 @@ struct stream_range: input_range> { stream_range() = delete; stream_range(stream &s): p_stream(&s) {} - stream_range(stream_range const &r): p_stream(r.p_stream) {} + stream_range(stream_range const &r): + p_stream(r.p_stream), p_item(r.p_item) + {} bool empty() const { if (!p_item.has_value()) {