Support implicit conversion between types

Ali Çehreli acehreli at yahoo.com
Wed Sep 4 14:14:26 PDT 2013


On 09/04/2013 01:46 PM, Adam D. Ruppe wrote:

 > D does not support implicit struct construction.

That's what I knew.

 > Interestingly though, it *does* support it for functions taking classes:
 >
 > class Foo {
 >          this(int i) {}
 > }
 >
 > void foo(Foo f...) {}
 >
 > void main() {
 >          foo(10);
 > }

WHAT? :) It even new's one?

But it works only for the ellipsis.

I wonder why the discrepancy...

Ali



More information about the Digitalmars-d-learn mailing list