Implicit type conversion for function calls?
David Nadlinger
see at klickverbot.at
Sun Jul 10 11:47:04 PDT 2011
On 7/10/11 3:29 PM, Simen Kjaeraas wrote:
> I'm trying to have this sort of code compile:
>
> ////////////////
> struct Foo {
> int data;
> this(int n) {
> data = n;
> }
> }
>
> void bar(Foo f) {}
>
> bar(3);
> ////////////////
>
> Is this even possible?
If I remember correctly, Walter said that this is a deliberate
limitation the last time I asked (when implementing my units of
measurement library). I think the intention is to avoid confusion about
what is actually going on behind the scenes, like it is possible in C++
with implicitly called constructors.
David
More information about the Digitalmars-d-learn
mailing list