static array in templated struct/class
ddos via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 5 13:06:02 PDT 2014
i wasn't intentionally creating a functionpointer, i just liked
the syntax x3 ... but i guess i should read into it now :)
thx for you help !
On Tuesday, 5 August 2014 at 19:51:33 UTC, Philippe Sigaud via
Digitalmars-d-learn wrote:
>> http://pastebin.com/34sbffSa
>
> Your problem comes from lengthSquared:
>
> public auto lengthSquared = function () => val.reduce!((a,b) =>
> a + b*b);
>
> That's an unusual way to define a method. Any reason why you
> are using
> a pointer to a function as a member? Do you need to be able to
> redefine it at runtime?
>
> I guess that in this case, the compiler cannot determine its
> return
> type and/or its size?
> I'd use:
>
> public auto lengthSquared () { return val.reduce!((a,b) => a +
> b*b);}
More information about the Digitalmars-d-learn
mailing list