From 3a5a56559409d63d33a83cec7945963c13a9ef54 Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Thu, 26 Sep 2013 20:25:09 -0700 Subject: [PATCH] feat(splay_map): add operator<< to splay_map for debugging --- src/util/splay_map.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/splay_map.h b/src/util/splay_map.h index a1fe75955..b7759cc2f 100644 --- a/src/util/splay_map.h +++ b/src/util/splay_map.h @@ -69,6 +69,16 @@ public: auto f_prime = [&](entry const & e) { f(e.first, e.second); }; return m_map.for_each(f_prime); } + + /** \brief (For debugging) Display the content of this splay map. */ + friend std::ostream & operator<<(std::ostream & out, splay_map const & m) { + out << "{"; + m.for_each([&out](K const & k, T const & v) { + out << k << " |-> " << v << "; "; + }); + out << "}"; + return out; + } }; template splay_map insert(splay_map const & m, K const & k, T const & v) {