[Interest] How to make the QString "10" behind "9" in QMap's key order

Konstantin Tokarev annulen at yandex.ru
Mon Apr 9 20:00:21 CEST 2018



09.04.2018, 20:53, "Roland Hughes" <roland at logikalsolutions.com>:
> Which isn't really a Qt answer.
>
> Long ago, before Nokia, there was the mantra/design principal that Qt would always be compatible with the standard stuff. A subset of means "compatible" is written with barely readable faint gray ink.

Times has changed, and since Qt 5 standard library is a requirement for Qt, and parts that duplicate standard library (or core language) are on their way to deprecation. See e.g. QtAlgorithms or Q_FOREACH.

>
> Just my 0.00002. I can only remember twice on projects where the inability to set the sort for a QMap hurt me. It hurt bad both times so I remember the hurt, but not what caused it.
>
> On 04/09/2018 12:46 PM, Konstantin Tokarev wrote:
>> 09.04.2018, 20:44, "Roland Hughes" <roland at logikalsolutions.com>:
>>> On 01/08/2018 06:26 AM, Mark Gaiser wrote:
>>>> You might want to look into std::map[1] as well. It allows setting a compare function, QMap doesn't. Going that route is most likely more efficient as your inserts will be sorted, no need to do std::sort afterwards.
>>>
>>> Jumping into this one late, but, is there any particular reason QMap doesn't allow overriding or supplying a comparison method? Has a feature request already been filed.
>>
>> Because there is std::map
>>> -- Roland Hughes, President Logikal Solutions (630)-205-1593 http://www.theminimumyouneedtoknow.com http://www.infiniteexposure.net http://www.johnsmith-book.com http://www.logikalblog.com http://www.interestingauthors.com/blog http://lesedi.us/ http://onedollarcontentstore.com , _______________________________________________ Interest mailing list Interest at qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
>>
>> --  Regards, Konstantin
>
> -- Roland Hughes, President Logikal Solutions (630)-205-1593 http://www.theminimumyouneedtoknow.com http://www.infiniteexposure.net http://www.johnsmith-book.com http://www.logikalblog.com http://www.interestingauthors.com/blog http://lesedi.us/ http://onedollarcontentstore.com


-- 
Regards,
Konstantin



More information about the Interest mailing list