[Issue 12597] Payload getter for std.typecons.Typedef
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 13 12:40:33 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=12597
Bastiaan Veelo <Bastiaan at Veelo.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Bastiaan at Veelo.net
--- Comment #16 from Bastiaan Veelo <Bastiaan at Veelo.net> ---
(In reply to bearophile_hugs from comment #15)
> (In reply to bearophile_hugs from comment #14)
>
> > > auto typedefVal(T)(T val)
> > > {
> > > return cast(TypedefType!T)val;
> > > }
> >
> > Yes, this ER asks for such safe function in Phobos.
>
> But it's better to add a template constraint to that T to be sure it's a
> Typedef.
No need:
/// Instantiating with a non-Typedef will return that type
static assert(is(TypedefType!int == int));
--
More information about the Digitalmars-d-bugs
mailing list