From 15d6b0157be996a62bc2403f7fcf444d769414dd Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 28 Feb 2017 17:22:29 +0100 Subject: [PATCH] remove detail::fmt_stream_range (not necessary anymore) --- ostd/stream.hh | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/ostd/stream.hh b/ostd/stream.hh index c51c630..07b6978 100644 --- a/ostd/stream.hh +++ b/ostd/stream.hh @@ -208,31 +208,15 @@ inline stream_range stream::iter() { return stream_range(*this); } -namespace detail { - /* lightweight output range for write/writef on streams */ - struct fmt_stream_range: output_range { - using value_type = char; - using reference = char &; - using size_type = size_t; - using difference_type = ptrdiff_t; - - fmt_stream_range(stream *s): p_s(s) {} - void put(char c) { - p_s->write_bytes(&c, 1); - } - stream *p_s; - }; -} - template inline void stream::write(T const &v) { - format_spec{'s', p_loc}.format_value(detail::fmt_stream_range{this}, v); + format_spec{'s', p_loc}.format_value(iter(), v); } template inline void stream::writef(string_range fmt, A const &...args) { format_spec sp{fmt, p_loc}; - sp.format(detail::fmt_stream_range{this}, args...); + sp.format(iter(), args...); } }