From 654ec0e0138f469972376ccb6b6d70e26ded3ef4 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 14 Jul 2024 14:20:04 +0900 Subject: [PATCH 1/2] feat: add stream operator to value --- include/toml11/serializer.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/toml11/serializer.hpp b/include/toml11/serializer.hpp index 43398f8..39661fb 100644 --- a/include/toml11/serializer.hpp +++ b/include/toml11/serializer.hpp @@ -1189,6 +1189,13 @@ std::string format(const std::vector::key_type>& ks, return ser(ks, v); } +template +std::ostream& operator<<(std::ostream& os, const basic_value& v) +{ + os << format(v); + return os; +} + } // toml #if defined(TOML11_COMPILE_SOURCES) From 93503e9c59d3386be3a7819fc671b1bc13841e99 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 14 Jul 2024 17:08:44 +0900 Subject: [PATCH 2/2] fix: remove operator<<(basic_value) from test --- tests/utility.hpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/utility.hpp b/tests/utility.hpp index a4df9b2..06c05e9 100644 --- a/tests/utility.hpp +++ b/tests/utility.hpp @@ -86,13 +86,6 @@ void toml11_test_parse_failure(F fn, std::string in, toml::detail::context c namespace toml { -template -std::ostream& operator<<(std::ostream& os, const toml::basic_value& v) -{ - os << toml::format(v); - return os; -} - std::ostream& operator<<(std::ostream& os, const integer_format_info&); std::ostream& operator<<(std::ostream& os, const floating_format_info&); std::ostream& operator<<(std::ostream& os, const string_format_info&);