for example we have map
map<char,int>mymap;
mymap['a']=101;
mymap['c']=45;
mymap['b']=76;
mymap['d']=98;
i know that if we iterate through map it will print element according to following way
a>=101;
b>=76;
c>=45;
d>=98;
how do such that small keys refer small values? or
a-45
b-76
c-98
d-101
?
thanks
If I’m understanding you correctly, you do not want to permanently associate values at all, you’re wanting to order two different sets of values, and then line them up together at some point. In which case, do not use a std::map. You want two different std::set (or multiset if you want to allow duplicate values) which orders the values separately. Then iterate through the two together at some point.