[Interest] QMap operator<() overload.

Sean Harmer sean.harmer at kdab.com
Sat Feb 28 12:52:41 CET 2015


On 26/02/2015 07:33, André Somers wrote:
> K. Frank schreef op 25-2-2015 om 16:46:
>> Hello Kai and Torgeir!
>>
>> Thank you for your insightful comments.
>>
>> I have some follow-up questions, in line, below.  (And sorry
>> for moving the discussion away from Qt.)
>>
>> On Wed, Feb 25, 2015 at 9:45 AM, Torgeir Lilleskog
>> <torgeir.lilleskog at gmail.com> wrote:
>>> I like this talk by Chandler Carruth:
>>> https://www.youtube.com/watch?v=fHNmRkzxHWs
>>>
>>> He says something along the lines of "I don't think I've ever seen a problem
>>> for which std::map is the right data structure"
> The problem is, I think, that QMap and QHash offer an API that is
> suitable for these lookups, while a QVector<QPair<T1,T2> > doesn't
> (insert std equivalents as required). That makes it way more attractive
> to use them for this type of problem, even if the underlying data
> structures don't really perform all that well in practice for many
> problems. So, the API matches the problem, but the data structure
> doesn't. And because not only performance, but also code reusability and
> readability count, the container with the API matching the task is
> chosen most often. I guess introducing a QMap or QHash like API over a
> simple vector-of-pairs would help mitigate that issue. It would be nice
> if it would allow some tuning, with things like doing a batch of inserts
> and only then re-sorting, or just saying you don't need the data to be
> sorted at all.

https://codereview.qt-project.org/#/c/105743/

Cheers,

Sean

-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions




More information about the Interest mailing list