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

This commit is contained in:
Soonho Kong 2013-09-27 01:40:04 -07:00
parent a05b6b476e
commit 6307beedc9

View file

@ -142,6 +142,16 @@ public:
return m_map.end();
}
/** \brief (For debugging) Display the content of this scoped map. */
friend std::ostream & operator<<(std::ostream & out, scoped_map const & m) {
out << "{";
for (auto e : m) {
out << e.first << " |-> " << e.second << "; ";
};
out << "}";
return out;
}
/**
\brief Auxiliary class for automatically performing a \c push
in the constructor and a \c pop in the destructor.