Find index of QVector by comparing an item
-
yea that's what I was thinking i.e binary search but I was looking for any easy solution(s).
BS is in qt.
Link is "Binary search in QT":http://doc.trolltech.com/qq/qq15-qalgorithms.html
-
Well, I don't think you'll be able to use the built-in BS. (you are not looking for an exact match).
Alternatively, you can go wild :) and implement a Range class and overload some operators... but I think it would be too much hassle for something like this.
-
Such a list has been implemented by a troll before and is available here
http://qt.gitorious.org/qt-labs/itemviews-ng/blobs/master/src/qsectionspans_p.h