Check out example codes for "storing value in map in reverse key". It will help you in understanding the concepts better.

Code Example 1

for (auto it = mymap.rbegin(); it != mymap.rend(); it++) { 
        cout << "(" << it->first << ", " 
             << it->second << ")" << endl;

Learn ReactJs, React Native from akashmittal.com