double -> double[]... | feature or bug?
Christopher Nicholson-Sauls
ibisbasenji at gmail.com
Wed Dec 22 22:34:41 PST 2010
On 12/22/10 15:06, Andrej Mitrovic wrote:
> Oooh. That cought me off guard, sorry.
>
> Thanks Steve.
>
I'll concede that the syntax can be odd at first, but it also enables
some interesting things. For example, this works:
class Foo {
this (int i, double f) { /*...*/ }
/*...*/
}
void someFunc ( Foo foo ... ) { /*...*/ }
someFunc( 5, 3.14 );
Basically, given a class (and I think struct's work as well) as the
variadic type, it will accept either an instance of said class, or any
combination of values which can be mapped to a constructor of that
class. It can be convenient sometimes.
-- Chris N-S
More information about the Digitalmars-d-learn
mailing list