From 251e55da42345a532139acd2d339827d8c149b95 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Thu, 14 Feb 2019 15:49:27 +0900 Subject: [PATCH] fix: don't ignore std::setw(0) --- toml/serializer.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/toml/serializer.hpp b/toml/serializer.hpp index 9fb3e30..5a32e3e 100644 --- a/toml/serializer.hpp +++ b/toml/serializer.hpp @@ -484,10 +484,12 @@ template std::basic_ostream& operator<<(std::basic_ostream& os, const value& v) { - // get status of std::setw(). if the width is narrower than 5 chars, ignore. - const auto w = os.width(); - const auto fprec = os.precision(); - os << visit(serializer((w > 5 ? w : 80), fprec, false), v); + // get status of std::setw(). + const std::size_t w = os.width(); + const int fprec = os.precision(); + + // the root object can't be an inline table. so pass `false`. + os << visit(serializer(w, fprec, false), v); return os; }