path: root/src/gui/kernel/qinputdevicemanager_p.h
diff options
authorMarc Mutz <>2019-06-05 21:59:46 +0200
committerMarc Mutz <>2019-06-06 08:23:02 +0200
commitcbc9d8947842b97f28e3acb2d87d80b4861d00b9 (patch)
tree726d9ebfb0235287d25dfbe45f64d10a8e9ed306 /src/gui/kernel/qinputdevicemanager_p.h
parent3619e87ba1c0b11b8406fee3e1fe5c1e96abb7ef (diff)
QInputDeviceManager: replace a QMap<enum,int> with a std::array<int,#enum-values>
QInputDeviceManager::DeviceType is a (non-flag) enum with all of five values. Using a self-rebalancing rb-tree to map these to an int is overkill. An array can do the job just as well and better, given the enum values are consecutive, and even if some don't make sense (like Unknown), the waste caused by unused array slots is more than compensated by the lack of any memory allocations. Even more so as the array API is 1:1 identical with the map's for the use-case at hand. Saves 1.2KiB in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: I1bfa115ac75e2f7d9a4bd9a0e3f3241bf68c9989 Reviewed-by: Tor Arne Vestbø <>
Diffstat (limited to 'src/gui/kernel/qinputdevicemanager_p.h')
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index 74494d712b..1d20b102e3 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -69,7 +69,9 @@ public:
- DeviceTypeTablet
+ DeviceTypeTablet,
+ NumDeviceTypes
QInputDeviceManager(QObject *parent = nullptr);