Typesafe variadic argument taking struct

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 20 09:30:42 PDT 2016


On Thursday, 20 October 2016 at 14:29:53 UTC, Satoshi wrote:
> Oh, really? I didn't notice that... (sarcasm)
>
> If I change struct Foo to class Foo it works.

It's because for some weird reason, this type of varargs allows 
implicit construction of an object. I don't know why, it's just a 
feature that was added a long time ago and never removed. However 
as you can see, it doesn't work for structs and IMO you should 
never use it.


More information about the Digitalmars-d-learn mailing list