Bug 531 – Nested template not usable directly in alias
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-11-16T13:09:00Z
Last change time
2014-02-15T13:21:15Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
wbaxter
Comments
Comment #0 by wbaxter — 2006-11-16T13:09:36Z
You can't use a nested template directly, though you can use it by declaring an intermediate alias to an instantiation of the outer template.
But it should be possible to access it directly.
Example:
----------------------------------
import std.stdio : writefln;
template Tuple(T...) { alias T Tuple; }
template Join(TList1...) {
template To(TList2...) {
alias Tuple!(TList1,TList2) To;
}
}
void main()
{
// Error: "used as a type"
alias Join!(1,2,3).To!(4,5,6) combo;
// Splitting it in two is OK, though
// alias Join!(1,2,3) jtmp;
// alias jtmp.To!(4,5,6) combo;
writefln(combo);
}