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

--- Comment #5 from Andrej Mitrovic <[email protected]> ---
(In reply to bearophile_hugs from comment #4)
> (In reply to Andrej Mitrovic from comment #3)
> > https://github.com/D-Programming-Language/phobos/pull/2116
> 
> Thank you. But:
> 
> > // safely cast to get the value that's being wrapped
> > int x = cast(OriginalType!MyInt)myInt;
> 
> casts are not safe. That example is not good.
> 
> Safer and shorter:
> 
> int x = myInt.get;

That's not safer if 'myInt' is a UDT that happens to define get(). You may end
up calling a function that returns something else entirely.

--

Reply via email to