Assigning a static array

Steven Schveighoffer schveiguy at yahoo.com
Fri Apr 19 06:59:21 PDT 2013


On Thu, 18 Apr 2013 18:08:48 -0400, bearophile <bearophileHUGS at lycos.com>
wrote:

> To avoid those bugs I have suggested the simpler possible thing: (V[]  
> elems...) to dup the data on the heap every time. In theory if you write  
> "(scope V[] elems...)" it will be free to not dup the data, avoiding the  
> heap allocation and the associated little performance loss. In practice  
> as you know "scope" is not yet implemented. D2 language is not close to  
> being fully implemented.

I am OK with this as long as it is done AFTER scope works (and I would
update my calls appropriately).

But in my specific case, I still want the second overload, because the
idea is ArrayList uses that slice as its actual storage.

-Steve


More information about the Digitalmars-d-learn mailing list