Ways to initialize static arrays

Stanislav Blinov blinov at loniir.ru
Thu Aug 26 05:11:54 PDT 2010


  Sorry, I pressed the wrong button so the message was sent to your 
email. Reciting:

  26.08.2010 1:53, Philippe Sigaud wrote:
>
>
>     I came up with the templates in my initial post. They seem to
>     work, but I doubt those are legal solutions.
>
>     .
>
>
> If they work, then they are legal :)
>
How it would be better for us all if we could always say that :)
> If I understand correctly what you want, you can achieve it with 
> compile-time-evaluable functions:
>
> Does that work for you?
>
Yes! Beautiful, thanks! That beats hell out of my clumsy templates :)

When I was on the way to my initial solutions I was under strong 
impression that T[N] func() won't work. Now I see that was because I 
didn't bother to fully understand how arrays are returned from 
functions. I got it now, so thanks a lot again!



More information about the Digitalmars-d-learn mailing list