]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
include/types: add an I/O helper for std::unordered_map
authorLeonid Usov <leonid.usov@ibm.com>
Wed, 28 Feb 2024 12:41:13 +0000 (14:41 +0200)
committerLeonid Usov <leonid.usov@ibm.com>
Mon, 4 Mar 2024 11:48:04 +0000 (13:48 +0200)
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
src/include/types.h

index b3777d9de4fdd6965ab4d65400ddba4bd59dbc9a..c3969f88a34c3a3a6fbfde82777f00b6e5f73fd4 100644 (file)
@@ -104,6 +104,8 @@ inline std::ostream& operator<<(std::ostream& out, const std::list<A,Alloc>& ili
 template<class A, class Comp, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::set<A, Comp, Alloc>& iset);
 template<class A, class Comp, class Alloc>
+inline std::ostream& operator<<(std::ostream& out, const std::unordered_set<A, Comp, Alloc>& iset);
+template<class A, class Comp, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::multiset<A,Comp,Alloc>& iset);
 template<class A, class B, class Comp, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::map<A,B,Comp,Alloc>& m);
@@ -209,6 +211,17 @@ inline std::ostream& operator<<(std::ostream& out, const std::set<A, Comp, Alloc
   return out;
 }
 
+template<class A, class Comp, class Alloc>
+inline std::ostream& operator<<(std::ostream& out, const std::unordered_set<A, Comp, Alloc>& iset) {
+  for (auto it = iset.begin();
+       it != iset.end();
+       ++it) {
+    if (it != iset.begin()) out << ",";
+    out << *it;
+  }
+  return out;
+}
+
 template<class A, class Comp, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::multiset<A,Comp,Alloc>& iset) {
   for (auto it = iset.begin();