D's limited template specialization abilities compared to C++
Peter Alexander
peter.alexander.au at gmail.com
Sat May 25 05:29:41 PDT 2013
On Saturday, 25 May 2013 at 12:13:42 UTC, Ahuzhgairl wrote:
> Uneditable newsgroups. Simplest case.
>
> struct Bar(T) {}
>
> struct Foo(T : A(B), A, B) {
> static void f() {}
> }
>
> void main() {
> Foo!(Bar!(int)).f();
> }
Two problems with that:
1. A(B) should be A!(B)
2. A won't bind to Bar because Bar is not a type, it is a
template. A should be an alias.
This works:
struct Bar(T) {}
struct Foo(T : A!(B), alias A, B) {
static void f() {}
}
void main() {
Foo!(Bar!(int)).f();
}
More information about the Digitalmars-d
mailing list