You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is true. In that case what you probably want to do is first remap your name to an int key:
int new_indexes = 0;
unordered_map<string, int> m;
auto f = m.find(name);
// and for each entry stringint idx; // Will store the remappingif (f != m.end()) {
idx = f->first;
} else {
idx = new_indexes++;
m[name] = idx;
}
Another alternative if you need this often would be to create a wrapper around the existing updatable_priority_queue structure that does this process transparently (remapping the inputs and outputs on the fly), but I've found it's usually easier and more performant to just remap to ints before running the algorithm.
Suppose that I want a unique "std::string name;" as Key, this queue is not work.
The text was updated successfully, but these errors were encountered: