fork(15) download
  1. #include <string>
  2. #include <iostream>
  3. #include <map>
  4. #include <utility>
  5. #include <array>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. map< array<double, 3>, string> mapa;
  12.  
  13. array<double, 3> a = {1,2,3};
  14. array<double, 3> b = {1,0,0};
  15.  
  16. mapa[a] = "a";
  17. mapa[b] = "b";
  18.  
  19. cout << mapa[a] << endl; //This print ok.
  20.  
  21. for(auto ii=mapa.begin(); ii!=mapa.end(); ++ii)
  22. {
  23. cout << '{' << ii->first[0] << ','
  24. << ii->first[1] << ','
  25. << ii->first[2] << "} : " << ii->second << '\n';
  26. }
  27. }
Success #stdin #stdout 0s 3020KB
stdin
Standard input is empty
stdout
a
{1,0,0} : b
{1,2,3} : a