From c0e8a947d0e4711b5876e0b2bf220cf8970cb6b1 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 10 Oct 2017 16:50:15 +1100 Subject: [PATCH] colour: use numeric_iterator and make_infix for ostream --- colour.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/colour.cpp b/colour.cpp index ff11cb4b..238bcc53 100644 --- a/colour.cpp +++ b/colour.cpp @@ -384,12 +384,9 @@ namespace json::tree { /////////////////////////////////////////////////////////////////////////////// template std::ostream& -util::operator<< (std::ostream &os, util::colour c) { - os << "colour("; - for (size_t i = 0; i < S - 1; ++i) - os << +c[i] << ", "; - os << +c[S-1] << ")"; - return os; +util::operator<< (std::ostream &os, util::colour c) +{ + return os << "[ " << util::make_infix (util::numeric_view (c), ", ") << ']'; } @@ -438,8 +435,10 @@ util::operator>> (std::istream &is, util::colour &c) return is; } +//----------------------------------------------------------------------------- template std::istream& util::operator>> (std::istream&, util::colour<3,uint8_t>&); + /////////////////////////////////////////////////////////////////////////////// #define INSTANTIATE_S_T(S,T) \ template \