[Interest] QMap operator<() overload.
K. Frank
kfrank29.c at gmail.com
Wed Feb 25 13:47:18 CET 2015
Hi Kai!
On Wed, Feb 25, 2015 at 5:16 AM, Koehne Kai <Kai.Koehne at theqtcompany.com> wrote:
>
>> -----Original Message-----
>> From: interest-bounces+kai.koehne=theqtcompany.com at qt-project.org
>> On Behalf Of manish sharma
>> ...
>> Hi,
>>
>> I am using a QMap to maintain my sorted list based with QString as key.
>>
>> QMap <QString, MyValue> list;
>> ...
> You have a couple of options:
> ...
> - Use another structure entirely (e.g. QPair), and sort when you need it [1]
>
> [1]: Might be a good idea anyway, because using QMap/std::map is very slow in a lot of use cases where you might think it's the 'right' abstraction.
>
Could you elaborate a little on your comment, and on for which use cases
QMap might not be the "right" abstraction?
I've always thought that maps (and hash-maps, e.g. std::unordered_map)
were the right tool when you want to look up a value using a key. Are
there pitfalls in this use case?
Or are there other use cases where you often see people using maps when
something else would be more efficient?
> Regards
>
> Kai
Thanks.
K. Frank
More information about the Interest
mailing list