mardi 10 mars 2015

C++ Dynamically assign std::map comparator

So I have two classes containing std::map members with effectively identical functionality except that the ordering of one map is std::less and the other std::greater.


If I create an abstract parent class and declare a single map member, is there any way to dynamically assign the comparator for this member in the derived class constructors? That way the functionality can obviously all reside in the parent class.


Aucun commentaire:

Enregistrer un commentaire