#include <iostream>
#include <utility>
#include <vector>
int main() {
std::vector<std::pair<int,int>> v;
v.push_back({10,20});
// This works
std::cout << v[0].first << " " << v[0].second << "\n";
// But I'd like to just be able to do
std::cout << v[0] << "\n";
}
How can we print a vector of pairs instead of printing separate values of the pairs like v[i].first and v[i].second? I want to print like cout << v[i]; but it shows an error.