4 ms·
Why? 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
by tolmasky 14y ago
Why? 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.