Browse - programming tips - stl get iterator from insertDate: 2007dec6 Language: C++ Q. Can I get an a iterator that points to the item I just inserted into a map? A. Yes. Here's how: #include <map> #include <string> typedef std::map<std::string, int> MYMAP; MYMAP mymap; MYMAP::_Pairib pair; MYMAP::iterator it; // insert() returns a pair pair = mymap.insert(MYMAP::value_type("hello", 4)); it = pair.first; // Now you can use "it", an iterator pointing to the just inserted item Add a commentSign in to add a comment |