Variadic Struct Parameter
Jonathan Levi
catanscout at gmail.com
Tue Jan 12 18:44:53 UTC 2021
On Tuesday, 12 January 2021 at 17:46:14 UTC, Q. Schroll wrote:
> It's obvious why arrays work, it's the primary use case. I have
> no idea why classes are allowed. That classes are allowed, but
> structs are not, makes no sense to me.
I like the variadic feature for classes, but I wish it worked for
structs as well, given that structs are value types on the stack
anyway, the same assembly could have either signature (assuming
matching argument/struct ordering).
But why does this compile?
```
struct S {/*...*/}
void fun(S s...) {/*...*/}
```
If structs do not work as variadic parameters, why does `fun`
still compile?
More information about the Digitalmars-d-learn
mailing list