Any way to automatically convert structs on return?
user1234
user1234 at 12.de
Thu Aug 1 14:20:29 UTC 2024
On Thursday, 1 August 2024 at 10:59:03 UTC, IchorDev wrote:
> On Thursday, 1 August 2024 at 09:55:08 UTC, user1234 wrote:
>> The problem would be that sorting the candidates of an
>> overload set would be more complicated. Also in certain cases
>> it would be less obvious to get which one is selected.
>
> Please elaborate about how this would interact with function
> overloads at all?
That was a general criticism of implicit construction. 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.
More information about the Digitalmars-d-learn
mailing list