mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-01-10 09:20:11 +00:00
fix: add stream operator for toml::table
This commit is contained in:
parent
8709e8a14e
commit
4c13085b35
@ -510,6 +510,18 @@ operator<<(std::basic_ostream<charT, traits>& os, const value& v)
|
||||
os << visit(serializer(w, fprec, false), v);
|
||||
return os;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& 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
|
||||
|
Loading…
Reference in New Issue
Block a user