@vcdebugger, why are you suggesting something like that? That is not even valid C++ code. You allocate memory on the heap, but don't use a pointer. He's code was already correct. Mind what you suggest.

@Dan3444, did you try debugging step by step? Frankly, I can't figure what could be wrong with that while condition to assert. Maybe you can show us the assertion text.