From 4c13085b35d7a45dca09046e3d289edec240bd7c Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 20 Mar 2019 19:30:08 +0900 Subject: [PATCH] fix: add stream operator for toml::table --- toml/serializer.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/toml/serializer.hpp b/toml/serializer.hpp index 248018b..3854ead 100644 --- a/toml/serializer.hpp +++ b/toml/serializer.hpp @@ -510,6 +510,18 @@ operator<<(std::basic_ostream& os, const value& v) os << visit(serializer(w, fprec, false), v); return os; } +template +std::basic_ostream& +operator<<(std::basic_ostream& os, const table& v) +{ + // get status of std::setw(). + const std::size_t w = os.width(); + const int fprec = os.precision(); + os.width(0); + // the root object can't be an inline table. so pass `false`. + os << serializer(w, fprec, false)(v); + return os; +} } // toml #endif// TOML11_SERIALIZER_HPP