[Issue 24307] [std.meta] weak values/alias for default values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 30 12:30:06 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24307

Dominikus Dittes Scherkl <dominikus at scherkl.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dominikus at scherkl.de

--- Comment #2 from Dominikus Dittes Scherkl <dominikus at scherkl.de> ---
If something doesn't convert implicitly, do it explicitly:

```d
auto lerp(I,F)(I a,I b,F per=F(.5)){}
struct myfloat{}
void main(){
    lerp(1,10,myfloat());
}
```

Of course then F need to have a fitting constructor. Or an opCast: 

```d
auto lerp(I,F)(I a,I b,F per=cast(F).5){}
struct myfloat{}
void main(){
    lerp(1,10,myfloat());
}
```

--


More information about the Digitalmars-d-bugs mailing list