you seem to be using the map as if it were a set. please switch to std::set