I'm wondering about what happens when I delete a QVector's item?
- Is it automatically removed from the QVe开发者_如何转开发ctor?
- Do I have to remove it manually?
Also, how can I find out the index of an iteration of the iterator?
Best regards
If you have a QVector<Thing*>
and delete
one of the Thing
s that stored in it, it will not be removed automatically from the vector. You need to do that yourself.
As far as I know, and from what I read in the docs, none of the QVector
iterators has a method to tell at what index it is positioned.
But if you have a reference to the vector itself (or at least to it's begin()
iterator), you can use:
int position = iter - v.begin();
精彩评论