I'm trying to implement an ordered multi map. But I need to give a function to compare whatever the multimap contain.
Ex:
bool compare(string a, string b) { return a<b; }
bool compare2(string a, string b) { return a.size()<b.size(); }
class MultiMap
{
private:
toCompare( string a, string b);
public:
MultiMap(function) { toCompare = function };
}
So I would like to make set the order in the multimap by a given function.
Is there a way, maybe some a pointer to a function. Hope you understand what I want to do, if not feel free to ask.
Also, notice this is not the real code, is just something I've writen to give an idea.
Aucun commentaire:
Enregistrer un commentaire