I need to set all the values in a map within a range of (0,N) to false. When I simply iterate over the range and set the value, it is rather slow, with the below example taking about 300 microseconds.
#include <map>
std::map<int, bool> mp;
int N = 600;
for (int i = 0; i < N; i++) {
mp[i] = false;
}
Is there a faster way to do this?