fork download
  1. #include <map>
  2. #include <iostream>
  3.  
  4. void print(const std::map<int, std::pair<int, int>> &m)
  5. {
  6. for (const auto& p : m)
  7. {
  8. std::cout << "key = " << p.first << ", value = {" << p.second.first << ", " << p.second.second << "}"<< std::endl;
  9. }
  10. }
  11.  
  12. int main()
  13. {
  14. print({{5, {42, 51}}, {0, {2, 3}}});
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
key = 0, value = {2, 3}
key = 5, value = {42, 51}