From: Adam C. Emerson Date: Sat, 20 May 2017 16:10:15 +0000 (-0400) Subject: common: Forward-declare container I/O overloads X-Git-Tag: v12.1.0~10^2~32^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7fefb0ebf7c6207f5b6bd184534ef86bcbcf394;p=ceph.git common: Forward-declare container I/O overloads 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 --- diff --git a/src/include/types.h b/src/include/types.h index 788fa9b3ca1a..1f0ee2b03a35 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -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 +inline ostream& operator<<(ostream&out, const pair& v); +template +inline ostream& operator<<(ostream& out, const vector& v); +template +inline ostream& operator<<(ostream& out, const deque& v); +template +inline ostream& operator<<(ostream&out, const boost::tuple &t); +template +inline ostream& operator<<(ostream& out, const list& ilist); +template +inline ostream& operator<<(ostream& out, const set& iset); +template +inline ostream& operator<<(ostream& out, const multiset& iset); +template +inline ostream& operator<<(ostream& out, const map& m); +template +inline ostream& operator<<(ostream& out, const multimap& m); + template inline ostream& operator<<(ostream& out, const pair& v) { return out << v.first << "," << v.second;