double -> double[]... | feature or bug?
Jonathan M Davis
jmdavisProg at gmx.com
Wed Dec 22 12:11:52 PST 2010
On Wednesday, December 22, 2010 12:05:18 Andrej Mitrovic wrote:
> DMD 2.051 with -unittest:
>
> import std.algorithm, std.range, std.stdio : writeln;
>
> void main() {}
>
> void average(double[]) { writeln("non-variadic"); }
> void average(double[]...) { writeln("variadic"); }
>
> unittest {
> average(1.5); // writes "variadic"
> }
What's the confusion? You gave it a double. That matches the variadic version,
no tthe array version. If you gave it an array of doubles, then it would match
the array version. That seems entirely straightforward. What's surprising about
it?
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list