A std::set is ordered and contains no duplicates (unlike a list). QSet, on the other hand, does not preserve order: it is closer to the mathematical notion of a set.
Using QMap keys only would be the closest match if uniqueness and order is important.
QMap<int,int> sss;
sss.insert(0x100, 0); // value is irrelevant
sss.insert(0x10, 0);
sss.insert(0, 0);
sss.insert(0x1000, 0);
qDebug() << sss.keys();
// (0, 16, 256, 4096)
QMap<int,int> sss;
sss.insert(0x100, 0); // value is irrelevant
sss.insert(0x10, 0);
sss.insert(0, 0);
sss.insert(0x1000, 0);
qDebug() << sss.keys();
// (0, 16, 256, 4096)
To copy to clipboard, switch view to plain text mode
If uniqueness is not a requirement then a simple QList that you sort before access is a good match.
Bookmarks