June 23, 2004 Template aliases not resolved | ||||
---|---|---|---|---|
| ||||
The compiler issues the error "no property 'Type' for type 'TypeList'" Source: struct Empty {} template TypeList(T, R) { struct TypeList { alias T Type; alias R Rest; } } template TypeList(T) { struct TypeList { alias T Type; alias Empty Rest; } } template TypeList(T : Empty) { alias Empty TypeList; } template TypeList() { alias Empty TypeList; } template Print(_T : Empty) { void Print() { } } template Print(_T) { void Print() { typeid(_T.Type).print(); .Print!(_T.Rest)(); } } alias TypeList!(int, TypeList!(float, TypeList!(char, Empty))) TL; int main() { Print!(TL)(); return 0; } -- andy |
Copyright © 1999-2021 by the D Language Foundation