[Issue 12597] Payload getter for std.typecons.Typedef

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 26 01:50:22 PDT 2014


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

--- Comment #14 from bearophile_hugs at eml.cc ---
(In reply to monkeyworks12 from comment #13)

> But casting to TypedefType!(typeof(x)) is always safe,

If it's always safe it shouldn't look dangerous, so it it shouldn't look like
"cast(" in a textual search.


> so if you want such a function, it's trivial to add one yourself.
> The main problem (getting the underlying type of a Typedef) is solved.
> 
> auto typedefVal(T)(T val)
> {
>     return cast(TypedefType!T)val;
> }

Yes, this ER asks for such safe function in Phobos.

--


More information about the Digitalmars-d-bugs mailing list