mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-12-16 03:08:52 +08:00
feat: add ostream operator to comment containers
This commit is contained in:
@@ -187,6 +187,17 @@ inline void swap(preserve_comments& lhs, preserve_comments& rhs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename charT, typename traits>
|
||||||
|
std::basic_ostream<charT, traits>&
|
||||||
|
operator<<(std::basic_ostream<charT, traits>& os, const preserve_comments& com)
|
||||||
|
{
|
||||||
|
for(const auto& c : com)
|
||||||
|
{
|
||||||
|
os << '#' << c << '\n';
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
namespace detail
|
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;}
|
inline void swap(const discard_comments&, const discard_comments&) noexcept {return;}
|
||||||
|
|
||||||
|
template<typename charT, typename traits>
|
||||||
|
std::basic_ostream<charT, traits>&
|
||||||
|
operator<<(std::basic_ostream<charT, traits>& os, const discard_comments&)
|
||||||
|
{
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
} // toml11
|
} // toml11
|
||||||
#endif// TOML11_COMMENTS_HPP
|
#endif// TOML11_COMMENTS_HPP
|
||||||
|
|||||||
Reference in New Issue
Block a user