On 10/31/14 2:38 PM, anonymous wrote:
I have a const(Object)[] and I want a shallow copy of the array.
..dup doesn't do it, which I thought a bug, but according to
Martin Nowak it's by design [1].
std.array.array fails, too. Is there really nothing in phobos for
this?
static import std.array;
On Sunday, 2 November 2014 at 00:33:53 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
If you want to make sure that a dynamic array refers to new
memory and is not
a slice of another one, then you'd typically use dup or idup,
and in almost
all cases, that's exactly what you want. However,
On Saturday, 1 November 2014 at 00:08:23 UTC, Jonathan M Davis
via Digitalmars-d-learn wrote:
So, by shallow copy, you mean that you want an array that
contains the same
elements but is a new array?
yes
If that's what you want, just slice the array.
auto b = a[];
This is the same as
On Saturday, November 01, 2014 10:30:05 anonymous via Digitalmars-d-learn
wrote:
On Saturday, 1 November 2014 at 00:08:23 UTC, Jonathan M Davis
via Digitalmars-d-learn wrote:
So, by shallow copy, you mean that you want an array that
contains the same
elements but is a new array?
yes
I have a const(Object)[] and I want a shallow copy of the array.
.dup doesn't do it, which I thought a bug, but according to
Martin Nowak it's by design [1].
std.array.array fails, too. Is there really nothing in phobos for
this?
static import std.array;
void main()
{
const(Object)[] a;
On Friday, 31 October 2014 at 18:39:00 UTC, anonymous wrote:
I have a const(Object)[] and I want a shallow copy of the array.
.dup doesn't do it, which I thought a bug, but according to
Martin Nowak it's by design [1].
std.array.array fails, too. Is there really nothing in phobos
for
this?
On Friday, October 31, 2014 18:38:59 anonymous via Digitalmars-d-learn wrote:
I have a const(Object)[] and I want a shallow copy of the array.
.dup doesn't do it, which I thought a bug, but according to
Martin Nowak it's by design [1].
std.array.array fails, too. Is there really nothing in