Any way to automatically convert structs on return?
Dukc
ajieskola at gmail.com
Thu Aug 1 09:08:27 UTC 2024
Emma kirjoitti 1.8.2024 klo 10.25:
> This kind of prevents ergonomic code like the above. Instead you have to
> use a function like `Option!T None(T)() => Option!T()` and then you have
> to repeat yourself with `return None!int` and etc... it's quite annoying :(
While this isn't exactly less verbose, I mention it because at least you
don't have to write the type twice:
```D
Option!int something() {
return typeof(return)(None());
}
More information about the Digitalmars-d-learn
mailing list