On Friday, 8 May 2015 at 11:32:50 UTC, Per Nordlöw wrote:
On Friday, 8 May 2015 at 11:29:53 UTC, Per Nordlöw wrote:
Such a feature would make the usage of this pattern very
(perhaps even absolutely) safe from a memory corruption point
of view.
An alternative non-restrictive (relaxed) possibile solution here
is to change `byLine` to instead return a reference counted or
GC-allocated object. Then in each iteration `ByLine.popFront()`
checks if the number of references for the internally stored line
is >= 2 (including its own reference). If so `ByLine.popFront()`
allocates a new instance of the internally stored line and return
that in the new iteration (through return-value of front()). I'm
assuming this is not implemented.
Is it possible to quickly query the number of references (and
slices) of a GC-allocated object?
Destroy, once again!