diff --git a/toml/comments.hpp b/toml/comments.hpp index 98f36c8..3ce88a1 100644 --- a/toml/comments.hpp +++ b/toml/comments.hpp @@ -187,6 +187,17 @@ inline void swap(preserve_comments& lhs, preserve_comments& rhs) return; } +template +std::basic_ostream& +operator<<(std::basic_ostream& os, const preserve_comments& com) +{ + for(const auto& c : com) + { + os << '#' << c << '\n'; + } + return os; +} + namespace detail { @@ -381,5 +392,12 @@ inline bool operator>=(const discard_comments&, const discard_comments&) noexcep inline void swap(const discard_comments&, const discard_comments&) noexcept {return;} +template +std::basic_ostream& +operator<<(std::basic_ostream& os, const discard_comments&) +{ + return os; +} + } // toml11 #endif// TOML11_COMMENTS_HPP