lundi 1 juin 2015

How to find all elements that correspond to a vector of keys?

I have a std::vector<std::string> k; with keys values of witch I seek for. I have a std::map<std::string void*> table; I search in. I want to get a std::vector<void*> v; of values for all keys that are in k (if such values exist in table, not all keys can be presented in the table and this fact is not important for me, while the fact that there can be much more keys than in k is important). How to find all values that corespond to keys?

use table[k_element] of table.find(k_element) for each element in k seems like a really bad way to do it also I could not find any algorithm in STL that could do it in a group manner...(

Aucun commentaire:

Enregistrer un commentaire