Skip to content

Commit

Permalink
QGraphicsView: Graph: don't compare pointers with op<
Browse files Browse the repository at this point in the history
It's undefined behavior. Use std::less, which has
defined behavior.

Change-Id: I990d197590cf535c1cb5c055d0b6798e602446dc
Reviewed-by: Olivier Goffart (Woboq GmbH) <[email protected]>
  • Loading branch information
marc-kdab committed Jan 17, 2016
1 parent f48f8ba commit 1ee43b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/widgets/graphicsview/qgraph_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
#include <QtCore/QString>
#include <QtCore/QDebug>

#include <functional> // for std::less

#include <float.h>

QT_BEGIN_NAMESPACE
Expand Down Expand Up @@ -213,9 +215,8 @@ class Graph
Vertex *from = it.from();
Vertex *to = it.to();
// do not return (from,to) *and* (to,from)
if (from < to) {
if (std::less<Vertex*>()(from, to))
conns.append(qMakePair(from, to));
}
}
return conns;
}
Expand Down

0 comments on commit 1ee43b9

Please sign in to comment.