vendredi 24 avril 2020

How to initialize a minimum value for a user defined struct in C++?

This is my user defined struct

struct Data
    {
        int value;
        int age;
    };

I am defining a function to get the maximum value in an unordered_map.

unordered_map<int,Data>::iterator maxValue(unordered_map<int, Data> map) {
    pair<int, Data> entryWithMaxValue = make_pair(INT_MIN, ??);
}

What should I write in place of the question mark so as to define a minimum value for type Data?

Aucun commentaire:

Enregistrer un commentaire