diff --git a/to_string.hh b/to_string.hh index a1b9cb568e..50d65276d5 100644 --- a/to_string.hh +++ b/to_string.hh @@ -80,6 +80,12 @@ to_string(std::initializer_list items) { return "[" + join(", ", std::begin(items), std::end(items)) + "]"; } +template +std::ostream& operator<<(std::ostream& os, const std::pair& p) { + os << "{" << p.first << ", " << p.second << "}"; + return os; +} + template std::ostream& operator<<(std::ostream& os, const std::unordered_set& items) { os << "{" << join(", ", items) << "}"; @@ -98,6 +104,18 @@ std::ostream& operator<<(std::ostream& os, const std::array& items) { return os; } +template +std::ostream& operator<<(std::ostream& os, const std::unordered_map& items) { + os << "{" << join(", ", items) << "}"; + return os; +} + +template +std::ostream& operator<<(std::ostream& os, const std::map& items) { + os << "{" << join(", ", items) << "}"; + return os; +} + namespace experimental { template