From the QVector
documentation:
QVector myQVector;
The default constructor constructs an empty QVector
.
myQVector[121] = ....
operator[](int(i)
has condition
i
must be a valid index position in the vector (i.e.,0 <= i < size()
).
So calling myQVector[121]
does not satisfy the conditions.
You may want to have a look at QMap
, std::map
or std::unordered_map
.