fork download
  1. #include <string>
  2. #include <map>
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7. std::map<int, std::string> map;
  8. auto itfirst = map.insert(map.begin(), std::make_pair(1000, "test"));
  9. auto* pf = &itfirst->second;
  10. auto it = map.begin();
  11. for (int i = 0; i < 10000; ++i) {
  12. it = map.insert(it, std::make_pair(i, "t"));
  13. }
  14. std::cout << *pf << std::endl;
  15. }
  16.  
Success #stdin #stdout 0s 3516KB
stdin
Standard input is empty
stdout
test