On 29/10/12 07:19, Ali Çehreli wrote:
On 10/28/2012 02:37 AM, Tobias Pankrath wrote:
the struct
SwA from above does neither correspond to SA nor to SB, it's imo more
like SC:
struct SC {
immutable(int)* i;
}
Just to confirm, the above indeed works:
struct SC {
On 10/28/2012 02:37 AM, Tobias Pankrath wrote:
the struct
SwA from above does neither correspond to SA nor to SB, it's imo more
like SC:
struct SC {
immutable(int)* i;
}
Just to confirm, the above indeed works:
struct SC {
immutable(int)* i;
}
void main()
{
immutable(SC)[] arr1;
On Monday, 29 October 2012 at 06:19:36 UTC, Ali Çehreli wrote:
Just to confirm, the above indeed works:
struct SC {
immutable(int)* i;
}
void main()
{
immutable(SC)[] arr1;
SC[] arr2 = arr1.dup;// compiles
}
Oh, I thought I've tried it.
[snip] [Really detailed description
Thank you for your detailed answer!
What I don't understand is the reason why you need the .dup in
the first place.
Take a look at these two structs that now contain an int* and an
int instead of string[].
struct SA {
int i;
}
struct SB {
int* i;
}
If you try to .dup an array of
So I have this immutable array with user defined structs but I
can not
make a copy from it.
See:
struct SwA {
string[] strings;
}
void main()
{
immutable(SwA)[] arr1;
SwA[] arr2 = arr1.dup;
}
Says:
Error: cannot implicitly convert element type immutable(SwA) to
mutable in
On 10/27/2012 02:30 AM, Tobias Pankrath wrote:
So I have this immutable array with user defined structs but I can not
make a copy from it.
See:
struct SwA {
string[] strings;
}
void main()
{
immutable(SwA)[] arr1;
SwA[] arr2 = arr1.dup;
}
Says:
Error: cannot implicitly convert element type