find maximum value in one element of dictionary in c++ -


i have map of lists , want find maximum value in list related every key. example, map[0](the lists related key 0) consists of 3 tuples {1,2},{4,2},{4,8} want find max{2,2,8}=8 in list of dictionary. want repeat every key in dictionary. code wrote follow:

std::map<int, list<std::tuple<int, int> >> map1;  list<std::tuple<int, int>> t = list<std::tuple<int, int>>(); t.push_back(make_tuple(4, 3)); t.push_back(make_tuple(2, 6)); map1[0] = t;  t.push_back(make_tuple(5, 6)); map1[1] = t; 

how can find maximum value in map1[0] , map1[1] separately?


Comments