4 ms·
No, because then I would need to find it again (eiter through the find() member function, or through operator[]) to get a reference to it. Without a reference,
by scott_s 14y ago
No, because then I would need to find it again (eiter through the find() member function, or through operator[]) to get a reference to it. Without a reference, I can't process it.
- tolmasky 14y agoWhy? In your original example you said "process x". You can also "process x" in mine: if (map.find(x) != map.end()) { // do stuff with x } You don't need the iterator to do anything with x. And if you do need the iterator (to perhaps keep iterating or something?) then you would also need to do extra work in the JavaScript example.