[Differential] [Changed Subscribers] D4348: [Containment Interface] No need for values() as contains() looks up keys

Aleix Pol Gonzalez noreply at phabricator.kde.org
Mon Jan 30 14:22:54 UTC 2017


apol added inline comments.

INLINE COMMENTS

> containmentinterface.cpp:565
>          QPoint posi; // will be overwritten with the event's position
> -        if (m_dropPoints.keys().contains(tjob)) {
> -            posi = m_dropPoints[tjob];
> +        if (m_dropPoints.contains(tjob)) {
> +            posi = m_dropPoints.value(tjob);

Here you're still doing 1 look-up too many.

`QPoint posi = m_dropPoints.value(tjob);` will possibly do the same, then you can `if (posi.isNull())`.

Otherwise you can `constFind` and `it!=constEnd`

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D4348

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: broulik, #plasma, davidedmundson
Cc: apol, plasma-devel, #frameworks, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170130/5abeabe3/attachment.html>


More information about the Kde-frameworks-devel mailing list