fork download
  1. #include <iostream>
  2. #include <map>
  3.  
  4. int main() {
  5. int obj = 2;
  6. int * ref = &obj;
  7. std::map<char, int *> map;
  8. map['q'] = ref;
  9. std::cout << "map['q']: " << map['q'] << "\n";
  10. map.clear();
  11. std::cout << "---\nref: " << ref << "\nobj: " << obj
  12. << "\nmap['q']: " << map['q'];
  13. return 0;
  14. }
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
map['q']: 0xbfd007b4
---
ref: 0xbfd007b4
obj: 2
map['q']: 0