static array in templated struct/class

Philippe Sigaud via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 5 12:51:22 PDT 2014


> 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