diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-17 20:35:23 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-13 10:35:58 +0000 |
commit | 05bcc9d2fc3aa0fd499cdf907b054707ac7bca15 (patch) | |
tree | c583f5ac9185d645f785b1170da13d9961ab1a11 /src/plugins/platforms/cocoa | |
parent | b693900da5748277e34b99e37fd51f18861e03c4 (diff) |
qcocoahelpers: make qtKey2CocoaKeySortLessThan a function object
This allows all compilers to inline the function call into the
std::sort instantiation.
Change-Id: I3d831ee9160dd89208f42b258ff2463f942a7630
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 3ecfd1b429..bb493ef2be 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -269,10 +269,14 @@ bool operator<(const KeyPair &entry, const Qt::Key &key) return entry.qtKey < key; } -static bool qtKey2CocoaKeySortLessThan(const KeyPair &entry1, const KeyPair &entry2) +struct qtKey2CocoaKeySortLessThan { - return entry1.qtKey < entry2.qtKey; -} + typedef bool result_type; + Q_DECL_CONSTEXPR result_type operator()(const KeyPair &entry1, const KeyPair &entry2) const Q_DECL_NOTHROW + { + return entry1.qtKey < entry2.qtKey; + } +}; static const int NumEntries = 59; static const KeyPair entries[NumEntries] = { @@ -352,7 +356,7 @@ QChar qt_mac_qtKey2CocoaKey(Qt::Key key) mustInit = false; for (int i=0; i<NumEntries; ++i) rev_entries[i] = entries[i]; - std::sort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan); + std::sort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan()); } const QVector<KeyPair>::iterator i = std::lower_bound(rev_entries.begin(), rev_entries.end(), key); |