Ways to initialize static arrays

Philippe Sigaud philippe.sigaud at gmail.com
Thu Aug 26 14:10:51 PDT 2010


On Thu, Aug 26, 2010 at 14:11, Stanislav Blinov <blinov at loniir.ru> wrote:

>  Sorry, I pressed the wrong button so the message was sent to your email.
> Reciting:
>
>
> Does that work for you?
>>
>>  Yes! Beautiful, thanks! That beats hell out of my clumsy templates :)
>

Your templates are not clumsy, it's typically the way some other PL would
process lists/arrays. I used to write a lot of these. But 6 months ago, CTFE
got seven-leagues boots and right now it's much easier on the eye to use CT
functions.


>
> 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!
>

There used to be a time, maybe not 18 months ago where returning static
arrays from functions was not possible, IIRC. Right now, I think you can use
them with no problem. Maybe someone well-versed in optimization will tell us
it's not a good idea, I don't know.


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100826/47951d1a/attachment.html>


More information about the Digitalmars-d-learn mailing list