feat(splay_map): add operator<< to splay_map for debugging

This commit is contained in:
Soonho Kong 2013-09-26 20:25:09 -07:00
parent 5e5087b0a3
commit 3a5a565594

View file

@ -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<typename K, typename T, typename CMP>
splay_map<K, T, CMP> insert(splay_map<K, T, CMP> const & m, K const & k, T const & v) {