fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <utility>
  5. #include <algorithm>
  6. int main()
  7. {
  8. std::vector<std::map<int, unsigned char>>grid =
  9. {
  10. {std::make_pair(1,'-'), std::make_pair(2,'-'), std::make_pair(3,'-') },
  11. {std::make_pair(4,'-'), std::make_pair(5,'-'), std::make_pair(6,'-') },
  12. {std::make_pair(7,'-'), std::make_pair(8,'-'), std::make_pair(9,'-') }
  13. };
  14.  
  15. std::cout << grid.at(0).at(1); // Same as grid.at(0)[1]
  16. std::cout << grid.at(0).begin()->second;
  17.  
  18. }
Success #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
--