Aug 10, 2022 at 3:07am Aug 10, 2022 at 3:07am UTC
It looks like the inner one isnt populated and the inner for is being skipped.
I don't see why right off, though.
Aug 10, 2022 at 4:58am Aug 10, 2022 at 4:58am UTC
found it.
you forgot to initialize i in your for loop. (22)
Last edited on Aug 10, 2022 at 4:59am Aug 10, 2022 at 4:59am UTC
Aug 10, 2022 at 11:23am Aug 10, 2022 at 11:23am UTC
one could also do these things:
* use a range based for loop, not iterators
* avoid using new
, so no pointers, no need for delete
* pass by reference
Aug 10, 2022 at 11:47am Aug 10, 2022 at 11:47am UTC
It has the 'smell' of C++98 code...
Aug 11, 2022 at 1:44am Aug 11, 2022 at 1:44am UTC
Thank all you for replies.
Thank you jonnin. That fixed it. Also looks like i'm blind.
Aug 11, 2022 at 3:29am Aug 11, 2022 at 3:29am UTC
Since C++17,
struct A { std::list<A> as; };
is guaranteed to work.
Last edited on Aug 11, 2022 at 3:29am Aug 11, 2022 at 3:29am UTC