digitalmars.D.learn - unqualified types in tuple
- Dan (8/8) Nov 21 2012 If I have a type tuple TL, which happens to be:
- Philippe Sigaud (14/14) Nov 21 2012 You can use std.typetuple.staticMap to map Unqual on each type:
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
Nov 21 2012
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); }
Nov 21 2012