There is a small possibility of overflow. Although you have changed mSize, it does not mean that the capacity of your list has really increased.
In addition, in the second loop of the first code, I don’t understand why k appears. This k always remains unchanged, so even if the program does not crash, I guess your result is wrong.
Then there is another possible reason, which is the problem of shallow copy and deep copy. You probably use new in your list, so this class has to implement the copy construction and assignment functions by itself, otherwise it may be deleted twice.
Finally, let me complain. When debugging in VS, when it crashes, it will show which statement it crashed in. You can post this screenshot at least. The code is not posted in full. Others who want to help you debug have no way to start. .
There is a small possibility of overflow. Although you have changed mSize, it does not mean that the capacity of your list has really increased.
In addition, in the second loop of the first code, I don’t understand why k appears.
This k always remains unchanged, so even if the program does not crash, I guess your result is wrong.
Then there is another possible reason, which is the problem of shallow copy and deep copy. You probably use new in your list, so this class has to implement the copy construction and assignment functions by itself, otherwise it may be deleted twice.
Finally, let me complain. When debugging in VS, when it crashes, it will show which statement it crashed in. You can post this screenshot at least. The code is not posted in full. Others who want to help you debug have no way to start. .