if I uncomment these
//BaseList baselist;
//MemberList memberlist;
outside the loop and comment out the ones inside the loop it
Here's the error message, which you omitted:
Assertion `node_algorithms::inited(to_insert)' failed.
From this we can understand that an element is being inserted twice. This isn't valid with intrusive containers in general.
When you have your lists inside the loop, they are destroyed and recreated each time. But when they are outside, you never clear them, and you also never clear values
, so this sequence occurs:
values
.values
to the lists.values
; it still has the previous 11 so now 22 elements.values
to the lists. Crash on the first one, because it is already in a list.One solution is to add values.clear()
at the top of the while(!done)
loop.