]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: Forward-declare container I/O overloads
authorAdam C. Emerson <aemerson@redhat.com>
Sat, 20 May 2017 16:10:15 +0000 (12:10 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 22 May 2017 15:17:00 +0000 (11:17 -0400)
This will allow strict ADL to find the right overload in the case of a
container of containers and unbreak compilation with Clang.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/include/types.h

index 788fa9b3ca1af4b2b6a87cada37c757ab26d44f2..1f0ee2b03a35a86599eb2b30956e61145a7acbee 100644 (file)
@@ -90,6 +90,29 @@ typedef off_t loff_t;
 
 // -- io helpers --
 
+// Forward declare all the I/O helpers so strict ADL can find them in
+// the case of containers of containers. I'm tempted to abstract this
+// stuff using template templates like I did for denc.
+
+template<class A, class B>
+inline ostream& operator<<(ostream&out, const pair<A,B>& v);
+template<class A, class Alloc>
+inline ostream& operator<<(ostream& out, const vector<A,Alloc>& v);
+template<class A, class Comp, class Alloc>
+inline ostream& operator<<(ostream& out, const deque<A,Alloc>& v);
+template<class A, class B, class C>
+inline ostream& operator<<(ostream&out, const boost::tuple<A, B, C> &t);
+template<class A, class Alloc>
+inline ostream& operator<<(ostream& out, const list<A,Alloc>& ilist);
+template<class A, class Comp, class Alloc>
+inline ostream& operator<<(ostream& out, const set<A, Comp, Alloc>& iset);
+template<class A, class Comp, class Alloc>
+inline ostream& operator<<(ostream& out, const multiset<A,Comp,Alloc>& iset);
+template<class A, class B, class Comp, class Alloc>
+inline ostream& operator<<(ostream& out, const map<A,B,Comp,Alloc>& m);
+template<class A, class B, class Comp, class Alloc>
+inline ostream& operator<<(ostream& out, const multimap<A,B,Comp,Alloc>& m);
+
 template<class A, class B>
 inline ostream& operator<<(ostream& out, const pair<A,B>& v) {
   return out << v.first << "," << v.second;