diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-17 20:36:00 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-13 10:38:11 +0000 |
commit | 35eb5c86785fb30eeb5555355062ce29f84d0e84 (patch) | |
tree | 94de1ea518cec99083c88478e9d67d630fcdbabd /src | |
parent | b3364cd8bf5ec6dc6d58dcb82c8285d6b3700a7a (diff) |
rcc: make qt_rcc_compare_hash a functor
This allows the compiler to inline the function call into the
std::sort instantiation.
Change-Id: If2b948c1d7202d6a81afd8a58cc9fab50a9709c1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/rcc/rcc.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 71438726f7..9e4fe04e12 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -937,10 +937,14 @@ bool RCCResourceLibrary::writeDataNames() return true; } -static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right) +struct qt_rcc_compare_hash { - return qt_hash(left->m_name) < qt_hash(right->m_name); -} + typedef bool result_type; + result_type operator()(const RCCFileInfo *left, const RCCFileInfo *right) const + { + return qt_hash(left->m_name) < qt_hash(right->m_name); + } +}; bool RCCResourceLibrary::writeDataStructure() { @@ -962,7 +966,7 @@ bool RCCResourceLibrary::writeDataStructure() //sort by hash value for binary lookup QList<RCCFileInfo*> m_children = file->m_children.values(); - std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash); + std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash()); //write out the actual data now for (int i = 0; i < m_children.size(); ++i) { @@ -981,7 +985,7 @@ bool RCCResourceLibrary::writeDataStructure() //sort by hash value for binary lookup QList<RCCFileInfo*> m_children = file->m_children.values(); - std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash); + std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash()); //write out the actual data now for (int i = 0; i < m_children.size(); ++i) { |