On Thursday, 23 March 2023 at 14:19:31 UTC, user1234 wrote:
omg, let's rewrite this...

I meant something like that. But you can't do that. I wanted WITHOUT explicit casting.

```d
struct MyVal
{
    private string value;

    @property auto toString(T)()
    {
        return value.to!T;
    }

    alias toString this;
}

auto a = MyVal("100");
auto b = MyVal("11.2");

int myInt       = a;
float myFloat   = b;
```


Reply via email to