It's not documented (and it's a mistake, I think), but in you can specialize the qMapLessThanKey
template function for your types (cf. the source). That will allow your type to use some other function rather than operator<
:
template<> bool qMapLessThanKey<int>(const int &key1, const int &key2)
{
return key1 > key2; // sort by operator> !
}
Nonetheless, std::map has the advantage that you can specify a different comparator per each map, while here you can't (all maps using your type must see that specialization, or everything will fall apart).