diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2015-06-29 19:02:18 +0100 |
---|---|---|
committer | Sérgio Martins <sergio.martins@kdab.com> | 2015-09-25 21:44:30 +0000 |
commit | 3719245dc34f0054930f5d595856863c52059ba8 (patch) | |
tree | 882a0a244db8cf1301bff788a3240c3b83f0edbe /src/widgets | |
parent | b9611d726684f1e3683d240a92ba32a5ce272d54 (diff) |
Save one full iteration and memory allocation with std::find()
Change-Id: Ia7c39e4d18ece02331df6ca6e50191a12b5d8cbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index e966c83fe7..701e7ab79b 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -47,6 +47,7 @@ #include <qapplication.h> #include <qdebug.h> +#include <algorithm> QT_BEGIN_NAMESPACE @@ -202,7 +203,7 @@ void QItemEditorFactory::registerEditor(int userType, QItemEditorCreatorBase *cr QItemEditorCreatorBase *oldCreator = it.value(); Q_ASSERT(oldCreator); creatorMap.erase(it); - if (!creatorMap.values().contains(oldCreator)) + if (std::find(creatorMap.cbegin(), creatorMap.cend(), oldCreator) == creatorMap.cend()) delete oldCreator; // if it is no more in use we can delete it } |