Debug assertion failed BLOCK_TYPE_IS_VALID(pHead->nblockuse) from Deconstructor

十年热恋 提交于 2019-12-02 09:08:34
_myArray = setterVect._myArray;

Your copy assignment operator is broken. After that operator, both instances have the same value for _myArray. So as soon as one is destructed, the other one is left with a pointer to something that no longer exists.

And the moral of the story -- use std::vector.

The error means heap corruption. There are lots of ways to corrupt a heap. Like David explained above, freeing a chunk of memory and then writing to it is one way.

Most heaps store some bytes of bookkeeping information before and after your chunk of memory. If your code misbehaves and changes the heaps data, you get this type of error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!