D - Template-aliases and typedefs
- Matthias Becker (3/3) Jan 27 2004 Just an idea: What about template-aliases and typedefs
- Andy Friesen (15/21) Jan 27 2004 The 'class Foo(T)' template form is a shorthand for:
- Matthias Becker (1/14) Jan 27 2004 Right. Thanks.
Just an idea: What about template-aliases and typedefs alias(T) OherTemplate(T, T, int) MyAlias; MyAlias!(double) foo;
Jan 27 2004
Matthias Becker wrote:Just an idea: What about template-aliases and typedefs alias(T) OherTemplate(T, T, int) MyAlias; MyAlias!(double) foo;The 'class Foo(T)' template form is a shorthand for: template Foo(T) { class Foo { ... } } So, if you want a template typedef, you just do: template MyAlias(T) { alias OtherTemplate!(T, T, int) MyAlias; } MyAlias!(double) foo; Kinda cool that D gets things that haven't even made it into C++, merely as a side effect of its design. :) -- andy
Jan 27 2004
The 'class Foo(T)' template form is a shorthand for:
template Foo(T) {
class Foo {
...
}
}
So, if you want a template typedef, you just do:
template MyAlias(T) {
alias OtherTemplate!(T, T, int) MyAlias;
}
MyAlias!(double) foo;
Kinda cool that D gets things that haven't even made it into C++, merely
as a side effect of its design. :)
Right. Thanks.
Jan 27 2004








Matthias Becker <Matthias_member pathlink.com>