From 60cc9ee47e8312ad8fd03351f57d9ed7b2092dda Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 4 Mar 2017 15:41:14 +0100 Subject: [PATCH] rename standard streams to feel less keywordy --- examples/format.cc | 2 +- ostd/io.hh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/format.cc b/examples/format.cc index 0825fe3..5c4d16b 100644 --- a/examples/format.cc +++ b/examples/format.cc @@ -137,7 +137,7 @@ int main() { "\"%d\", \"%f\", \"%X\"", 123456789, 12345.6789123, 0x123456789ABCDEF ); std::locale::global(std::locale{""}); - out.imbue(std::locale{}); + cout.imbue(std::locale{}); writefln("\n-- number format with system locale --"); writefln( "\"%d\", \"%f\", \"%X\"", 123456789, 12345.6789123, 0x123456789ABCDEF diff --git a/ostd/io.hh b/ostd/io.hh index c2b2d23..9289c29 100644 --- a/ostd/io.hh +++ b/ostd/io.hh @@ -168,9 +168,9 @@ inline void swap(file_stream &a, file_stream &b) { a.swap(b); } -static file_stream in(stdin); -static file_stream out(stdout); -static file_stream err(stderr); +static file_stream cin{stdin}; +static file_stream cout{stdout}; +static file_stream cerr{stderr}; /* no need to call anything from file_stream, prefer simple calls... */ @@ -209,7 +209,7 @@ namespace detail { template inline void write(A const &...args) { - format_spec sp{'s', out.getloc()}; + format_spec sp{'s', cout.getloc()}; (sp.format_value(detail::stdout_range{}, args), ...); } @@ -223,7 +223,7 @@ inline void writeln(A const &...args) { template inline void writef(string_range fmt, A const &...args) { - format_spec sp{fmt, out.getloc()}; + format_spec sp{fmt, cout.getloc()}; sp.format(detail::stdout_range{}, args...); }