November 21, 2012 unqualified types in tuple | ||||
---|---|---|---|---|
| ||||
If I have a type tuple TL, which happens to be: alias TypeTuple!(const(int), immutable(double), string) TL; How can I convert it into a tuple of (int, double, string)? Effectively I need a way to get a new UnqualTL where each type in the list is itself unqualified. I need to do this without knowing the alias. Thanks Dan |
November 21, 2012 Re: unqualified types in tuple | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dan Attachments:
| You can use std.typetuple.staticMap to map Unqual on each type: import std.typetuple; import std.stdio; template UnqualifyTuple(T...) { alias staticMap!(Unqual, T) UnqualifyTuple; } void main() { alias TypeTuple!(const(int), immutable(double), string) TL; writeln(TL.stringof); alias UnqualifyTuple!TL UQTL; writeln(UQTL.stringof); } |
Copyright © 1999-2021 by the D Language Foundation