From 80c3e343e76aae5f2d215b58cbc2963e4c517ac6 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Tue, 6 Aug 2024 01:28:45 +0900 Subject: [PATCH] fix: if aot is empty, format as oneline [[aot]] itself defines an empty table, so there is no way to format an empty array-of-tables as table-like format. the only way to format an empty array is: = []. --- include/toml11/serializer.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/toml11/serializer.hpp b/include/toml11/serializer.hpp index 269cefb7..a3f148e2 100644 --- a/include/toml11/serializer.hpp +++ b/include/toml11/serializer.hpp @@ -557,11 +557,16 @@ class serializer } } } - if(this->force_inline_ && f == array_format::array_of_tables) { f = array_format::multiline; } + if(a.empty() && f == array_format::array_of_tables) + { + f = array_format::oneline; + } + + // -------------------------------------------------------------------- if(f == array_format::array_of_tables) {