On Thursday, 23 January 2014 at 15:24:19 UTC, Chris wrote:
Thanks, that was fast! Yes I was tinkering around with
pointers, but didn't get it right, you did. However, the output
is still the same, i.e. two different sets:
// After creating and changing
<div id="1">
Hello, world!
<span>
</span>
</div>
// The Elements in Tree.elements:
[<div>
</div>
, <span>
</span>
]
Maybe more code will explain more.
Note that array requires data to be continuous, so if there are
no space for new element, it reallocates the whole chunk and
therefore invalidates old pointers. Use linked list or replace
struct with class.