Mutable enums

Steven Schveighoffer schveiguy at yahoo.com
Wed Nov 16 12:03:07 PST 2011


On Wed, 16 Nov 2011 15:00:16 -0500, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> The one case which is difficult to do is initializing a fixed-size array  
> with a literal that uses runtime data.  I suppose we'd need a function  
> that returns a fixed-sized array made of its arguments, and doing the  
> init builds it in place.  i.e.:
>
> Object[3] objs = array_fixed(new Foo, new Bar, new Qux);
>
> would not do any moving of references, it would construct the fixed  
> sized array in-place.  Initializing fixed sized arrays with array  
> literals already needs attention anyway.

one benefit here, we could use auto:

auto objs = array_fixed(new Foo, new Bar, new Qux);

-Steve


More information about the Digitalmars-d-learn mailing list