I've encountered some really weird behavior with array::erase method when erasing multiple items of non-primitive type.
Let's have for example:
Code: Select all
core::array<core::stringc> aaa;
aaa.push_back(core::stringc("1"));
aaa.push_back(core::stringc("2"));
aaa.push_back(core::stringc("3"));
aaa.push_back(core::stringc("4"));
aaa.push_back(core::stringc("5"));
Code: Select all
aaa.erase(0, 2);
Calling
Code: Select all
aaa.erase(1, 2);
At first, I thought it was some memory-related bug of my arrays, but then I tried and ended up with the exact same results even using the stock Irrlicht 1.7.1.
All the mess seems to be caused by this condition in the erase method:
Code: Select all
if (i > index+count)
allocator.destruct(&data[i-count]);
According to the SVN, this bug seems to be present in all Irrlicht versions (as far as I browsed it).
edit: just grammar correction