better than union and array questions

Saaa empty at needmail.com
Fri Sep 18 17:36:51 PDT 2009


> (D1 Phobos)
> I use the struct below like: Struct[][char[]] _struct;
>
> Is there a better way to support arrays of any type?
> Currently all the code working with these Structs are templated with loads 
> of static ifs in them.
>
> Also, is it possible to add a .deepdup property to all arrays?
>
> One last question:
> Will "a[]=b.dup;" copy b twice?
>
One more :)

int[] array;
array.length = 100;
array.length = 0;
//no other arrays pointing/slicing to this array

This way I can be sure for the following 100 element concatenations the 
array won't be copied.
Or isn't this implicitly part of the D spec? 




More information about the Digitalmars-d-learn mailing list