vendredi 30 juin 2017

Insert a map into other map with a unique type key (2)

hello guys i am new to maps in C++ i am having a question regarding copying a particular type map to another map of same kind the details are shown below I initially declared a map like this

map<string,int> objmap,obj_porcess ;
 for(int i = 0; i < 10; i++) {
 objmap ["process"+to_string(i)]=i+10//some processing the to_string is just in case but i have strings with names for all 10 values
 }

like

objmap["process_today"]=1;
objmap["process_yesterday"]=-1;
objmap["process_tommorow"]=2;

now i want to define some thing like this just my key word should be added with the process and remaining all can be same for all the keys from obj_process

obj_process["today"]=objmap["process_today"] ;

instead of defining all 10 can i have a simple code cause in here i took an example of 10 but i have like 200 set of different strings in the key of map i already asked a qn for exact opposite one this was my previous qn now when i try its vice versa i got an issue hope i find some help

Aucun commentaire:

Enregistrer un commentaire