if I have a field in class like below,
class MyClass {
public:
shared_ptr<map<int, int>> my_map;
}
The default map<int,int>
's comparison function is less<int>
, but I would like to initialize my_map
as
my_map = make_shared<map<int, int, greater<int>>();
sometimes,
This doesnt compile, what other way I can have a shared_ptr<map<int, int>>
that in two different object of MyClass
, one has less<int>
and the other have greater<int>
so that the my_map
in each object is sorted differently?
Aucun commentaire:
Enregistrer un commentaire