Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在将一个项目附加到 aQList指向的 aQMutableListIterator之后,我找出迭代器的下一个值指向列表之外。或者我不能将迭代器指向列表中除开头或结尾之外的任何位置吗?请我需要帮助。
QList
QMutableListIterator
来自 Qt 文档:
当迭代器处于活动状态时(而不是通过迭代器),不应直接对列表进行任何更改,因为这可能会使迭代器无效并导致未定义的行为。
附加到列表可能会导致它的内存被重新分配,这意味着迭代器指向一个无效的位置。