Guest User

Untitled

a guest
Jul 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4.  
  5. int main()
  6. {
  7.     using namespace std;
  8.  
  9.     map<vector<int>, string> dictionary;
  10.  
  11.     vector<int>* vector1 = new vector<int>{ 1, 2, 3 };
  12.  
  13.     dictionary.insert(pair<vector<int>, string>(*vector1, "vector1"));
  14.  
  15.     vector1->push_back(4);
  16.     dictionary.insert(pair<vector<int>, string>(*vector1, "vector2"));
  17.  
  18.     map<vector<int>, string>::iterator it = dictionary.begin();
  19.     for (it = dictionary.begin(); it != dictionary.end(); ++it)
  20.     {
  21.         cout << " value " << it->second << '\n';
  22.     }
  23.  
  24.     delete vector1;
  25.    
  26.     return EXIT_SUCCESS;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment