From e9a7fb0955794a75f2736b6f1859ab9973b25fff Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sat, 29 Jul 2023 16:00:10 +0200 Subject: [PATCH] =?UTF-8?q?chore(cpp):=20add=20=E2=80=B9<<=E2=80=BA=20for?= =?UTF-8?q?=20containers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matej Focko --- .common/cpp/skeleton.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index 8202982..5ce8bb9 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -39,6 +39,17 @@ std::ostream &operator<<(std::ostream &os, std::pair const &p) { return os << p.first << " " << p.second; } +template ::value, + typename C::value_type>::type> +std::ostream &operator<<(std::ostream &os, const C &v) { + std::string sep; + for (const T &x : v) { + os << sep << x, sep = " "; + } + + return os; +} template inline void answer(const T &ans) {