Any way to automatically convert structs on return?

IchorDev zxinsworld at gmail.com
Fri Aug 2 00:15:38 UTC 2024


On Thursday, 1 August 2024 at 14:20:29 UTC, user1234 wrote:
> That was a general criticism of implicit construction.

We are only talking about it in the context of returning from a 
function.

> The classic example is
>
> ```d
> struct S {int i;}
> function f(S s);
> function f(int i);
>
> unittest { f(0); } // both match
> ```
>
> unless the idea would rather be to allow implicit construction 
> only in the context of initialization.

You are wasting my time. Show me how this applies to retuning 
from within a function.


More information about the Digitalmars-d-learn mailing list