From 42a5fb3b7562dac09dbf4575558820297317965e Mon Sep 17 00:00:00 2001 From: Leonid Usov Date: Wed, 28 Feb 2024 14:41:13 +0200 Subject: [PATCH] include/types: add an I/O helper for std::unordered_map Signed-off-by: Leonid Usov --- src/include/types.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/include/types.h b/src/include/types.h index b3777d9de4f..c3969f88a34 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -104,6 +104,8 @@ inline std::ostream& operator<<(std::ostream& out, const std::list& ili template inline std::ostream& operator<<(std::ostream& out, const std::set& iset); template +inline std::ostream& operator<<(std::ostream& out, const std::unordered_set& iset); +template inline std::ostream& operator<<(std::ostream& out, const std::multiset& iset); template inline std::ostream& operator<<(std::ostream& out, const std::map& m); @@ -209,6 +211,17 @@ inline std::ostream& operator<<(std::ostream& out, const std::set +inline std::ostream& operator<<(std::ostream& out, const std::unordered_set& iset) { + for (auto it = iset.begin(); + it != iset.end(); + ++it) { + if (it != iset.begin()) out << ","; + out << *it; + } + return out; +} + template inline std::ostream& operator<<(std::ostream& out, const std::multiset& iset) { for (auto it = iset.begin(); -- 2.39.5