From 3719245dc34f0054930f5d595856863c52059ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Mon, 29 Jun 2015 19:02:18 +0100 Subject: Save one full iteration and memory allocation with std::find() Change-Id: Ia7c39e4d18ece02331df6ca6e50191a12b5d8cbf Reviewed-by: Thiago Macieira --- src/widgets/itemviews/qitemeditorfactory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets/itemviews/qitemeditorfactory.cpp') 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 #include +#include 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 } -- cgit v1.2.3