c++ - What's the best way to search from several map<key,value>? -


i have created vector contains several map<>.

vector<map<key,value>*> v; v.push_back(&map1); // ... v.push_back(&map2); // ... v.push_back(&map3); 

at point of time, if value has retrieved, iterate through vector , find key in every map element (i.e. v[0], v[1] etc.) until it's found. best way ? open suggestion. idea have given, yet implement way (please show if mistake).

edit: it's not important, in map element found. in multiple modules different maps prepared. , added 1 one code progresses. whenever key searched, result should searched in maps combined till time.

without more information on purpose , use, might little difficult answer. example, necessary have multiple map objects? if not, store of items in single map , eliminate vector altogether. more efficient lookups. if there duplicate entries in maps, key each value include differentiating information defines map values put.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -