fix: serialization of array containing a table

table in a (hetero-) array should be force-inlined
This commit is contained in:
ToruNiina 2021-06-27 16:28:41 +09:00
parent 2c72329530
commit 45bd566f7a

View File

@ -309,7 +309,17 @@ struct serializer
continue;
}
std::string next_elem;
next_elem += toml::visit(*this, item);
if(item.is_table())
{
serializer ser(*this);
ser.can_be_inlined_ = true;
ser.width_ = std::numeric_limits<std::size_t>::max();
next_elem += toml::visit(ser, item);
}
else
{
next_elem += toml::visit(*this, item);
}
// comma before newline.
if(!next_elem.empty() && next_elem.back() == '\n') {next_elem.pop_back();}