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.
QList::operator[] 中的 ASSERT 失败:“索引超出范围”,为什么?
QList<int> tanksLevel; ...... for(int i=0; i < 6; i++) tanksLevel[i] = rand() %51;
这意味着i >= tanksLevel.size()。检查那个。您可能想先用正确的大小初始化您的列表,或者使用QList::append而不是operator[].
i >= tanksLevel.size()
QList::append
operator[]