fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5.  
  6. std::ostream& operator<<(std::ostream&os, const std::vector<int>& v)
  7. {
  8. os << "{ ";
  9. for (auto e : v)
  10. os << e << ' ';
  11. return os << '}';
  12. }
  13.  
  14. int main()
  15. {
  16. std::map<std::string, std::vector<int>> vecs;
  17.  
  18. for (int i = 0; i < 10; ++i)
  19. vecs[std::string(1, 'a' + i)] = std::vector<int> { i * 2, i * 2 + 1, i * 2 + 2 };
  20.  
  21. for (auto& pair : vecs)
  22. std::cout << pair.first << " = " << pair.second << '\n';
  23. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
a = { 0 1 2 }
b = { 2 3 4 }
c = { 4 5 6 }
d = { 6 7 8 }
e = { 8 9 10 }
f = { 10 11 12 }
g = { 12 13 14 }
h = { 14 15 16 }
i = { 16 17 18 }
j = { 18 19 20 }