Save one full iteration and memory allocation with std::find()
Change-Id: Ia7c39e4d18ece02331df6ca6e50191a12b5d8cbf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
b9611d7266
commit
3719245dc3
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue