How can you deep-copy a std.container.Array instance?
The actual array data is heap-allocated and reference-counted.
Assignment and .dup only create additional references.
Using a copy constructor yields an error:
Array!Foo x;
Array!Foo y = Array!Foo(x);
Error: template std.container.Array!(Fo
On Thursday, 9 October 2014 at 21:14:46 UTC, qznc wrote:
How can you deep-copy a std.container.Array instance?
Ok, the deep-copy problem already got resolved on reddit: Use dup.
However, the error is still open. You cannot give an Array!X
argument to constructor/replace/insertBefore of Array!X
On Thursday, 9 October 2014 at 21:24:55 UTC, qznc wrote:
On Thursday, 9 October 2014 at 21:14:46 UTC, qznc wrote:
How can you deep-copy a std.container.Array instance?
Ok, the deep-copy problem already got resolved on reddit: Use
dup.
However, the error is still open. You cannot give an Arr
On Friday, 10 October 2014 at 06:27:35 UTC, yazd wrote:
On Thursday, 9 October 2014 at 21:24:55 UTC, qznc wrote:
On Thursday, 9 October 2014 at 21:14:46 UTC, qznc wrote:
How can you deep-copy a std.container.Array instance?
Ok, the deep-copy problem already got resolved on reddit: Use
dup.
Like the following? That did not work.
Array!Foo y = Array!Foo(x[]);
How does it not work?
It compiles successfully: http://dpaste.dzfl.pl/583d20e426a0
On Friday, 10 October 2014 at 10:32:17 UTC, yazd wrote:
Like the following? That did not work.
Array!Foo y = Array!Foo(x[]);
How does it not work?
It compiles successfully: http://dpaste.dzfl.pl/583d20e426a0
yeah man.
On Friday, 10 October 2014 at 10:59:59 UTC, Sag Academy wrote:
On Friday, 10 October 2014 at 10:32:17 UTC, yazd wrote:
Like the following? That did not work.
Array!Foo y = Array!Foo(x[]);
How does it not work?
It compiles successfully: http://dpaste.dzfl.pl/583d20e426a0
yeah man.
You are