What happens to QVector's item when it's deleted elsewhere?
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 Things 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();
加载中,请稍侯......
精彩评论