-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
stackoverflown/questions/qmap-qcolor-32512125/main.cpp
Lines 4 to 8 in b3d59cf
| bool operator<(const QColor & a, const QColor & b) { | |
| return a.redF() < b.redF() | |
| || a.greenF() < b.greenF() | |
| || a.blueF() < b.blueF() | |
| || a.alphaF() < b.alphaF(); |
This comparison function violates the requirement for Strict Weak Ordering and will cause undefined behaviour/corruption inside the map.
Consider colours A(255, 0, 0) and B(0, 255, 0). Both A < B and B < A will return true.
KubaO
Metadata
Metadata
Assignees
Labels
No labels