Thread overview | |||||
---|---|---|---|---|---|
|
January 27, 2004 Template-aliases and typedefs | ||||
---|---|---|---|---|
| ||||
Just an idea: What about template-aliases and typedefs alias(T) OherTemplate(T, T, int) MyAlias; MyAlias!(double) foo; |
January 27, 2004 Re: Template-aliases and typedefs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | 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
|
January 27, 2004 Re: Template-aliases and typedefs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | >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.
|
Copyright © 1999-2021 by the D Language Foundation