mirror of
https://gitlab.com/mfocko/Codeforces.git
synced 2024-12-22 07:01:21 +01:00
chore(cpp): add ‹<<› for containers
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
f6e3929fee
commit
e9a7fb0955
1 changed files with 11 additions and 0 deletions
|
@ -39,6 +39,17 @@ std::ostream &operator<<(std::ostream &os, std::pair<T, U> const &p) {
|
||||||
return os << p.first << " " << p.second;
|
return os << p.first << " " << p.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename C, typename T = typename std::enable_if<
|
||||||
|
!std::is_same<C, std::string>::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 <typename T>
|
template <typename T>
|
||||||
inline void answer(const T &ans) {
|
inline void answer(const T &ans) {
|
||||||
|
|
Loading…
Reference in a new issue