diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-08-04 08:13:56 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-08-05 05:19:10 +0200 |
commit | ec40e505068c9e75d69f13666aa3f182cf2fc2c4 (patch) | |
tree | b3f179a0dff07d19705f9398eaa4ecba62491068 /src/corelib/kernel/qmetatypeswitcher_p.h | |
parent | ae0b080c019025c2a949cf9468294ecf2b4eacb1 (diff) |
QXpmHandler: avoid double-lookup
The code used the if (!contains()) { insert() } anti-pattern,
necessitated by Qt's deviation from the STL of allowing insert() to
overwrite an existing entry, causing two lookups of the same key.
Since QMap these days is a wrapper around std::map, fix by using the
real thing (a std::map) instead, which sports the non-broken insert()
semantics already, avoiding the need to play tricks like detecting a
size increase in order to find whether an insertion took place. It
also simplifies the loop later on, and we can transparently use pmr,
when available.
Change-Id: Iedd8d5691514a7705a55c27376446304b20af071
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmetatypeswitcher_p.h')
0 files changed, 0 insertions, 0 deletions