]> git.apps.os.sepia.ceph.com Git - ceph.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>
Thu, 14 Mar 2024 19:07:52 +0000 (15:07 -0400)
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
(cherry picked from commit 42a5fb3b7562dac09dbf4575558820297317965e)

src/include/types.h

index a50a506eb0bc265cd1da5d832334876ec461ee3d..6512aae510a764ff93a2b2cc5cb5390960dce827 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();