[Interest] Operator QMap<uint, uint>[] is casting to int?

Jason H jhihn at gmx.com
Fri May 3 16:44:21 CEST 2019


Given the code below:
QMap<uint, uint> reverseHistogram;
...
QList<uint> reverseKeys = reverseHistogram.keys();
int foregroundIndex = reverseHistogram.size()-2;           // arg, QMap::size() returns signed
uint foregroundPixels = reverseKeys[foregroundIndex];
uint foregroundColor = reverseKeys[foregroundPixels];
uint foregroundColor = reverseKeys[foregroundPixels]; //main.cpp:66:37: warning: implicit conversion changes signedness: 'uint' (aka 'unsigned int') to 'int'

Where is the "signed" conversion happening?




More information about the Interest mailing list