#include
#include
#include
int main()
{
QList list;
list << 3 << 3 << 6 << 6 << 6 << 8;
QList::iterator it;
it = qLowerBound(list.begin(), list.end(), 5);
list.insert(it, 5);
qDebug() << list; // output: ( 3, 3, 5, 6, 6, 6, 8 )
it = qLowerBound(list.begin(), list.end(), 12);
list.insert(it, 12);
qDebug() << list; // output: ( 3, 3, 5, 6, 6, 6, 8, 12 )
it = qLowerBound(list.begin(), list.end(), 12);
list.insert(it, 12);
qDebug() << list; // output: ( 3, 3, 5, 6, 6, 6, 8, 12, 12 )
QVector vect;
vect << 3 << 3 << 6 << 6 << 6 << 8;
QVector::iterator begin6 =
qLowerBound(vect.begin(), vect.end(), 6);
QVector::iterator end6 =
qUpperBound(vect.begin(), vect.end(), 6);
QVector vect2(end6-begin6);
qCopy(begin6, end6, vect2.begin());
qDebug() << vect2; // output: ( 6, 6, 6 )
qCount(vect.begin(), vect.end(), 6, count6);
qDebug() << count6; // output: 3
return 0;
}