D's limited template specialization abilities compared to C++

Kenji Hara k.hara.pg at gmail.com
Sat May 25 05:32:58 PDT 2013


2013/5/25 Ahuzhgairl <bulletproofchest at gmail.com>

> Uneditable newsgroups. Simplest case.
>
> struct Bar(T) {}
>
> struct Foo(T : A(B), A, B) {
>     static void f() {}
> }
>
> void main() {
>     Foo!(Bar!(int)).f();
> }
>

It would work.

struct Bar(T) {}
struct Foo(T : A!(B), alias A, B) {   // 1, 2
    static void f() {}
}
void main() {
    Foo!(Bar!(int)).f();
}

1. should use A!(B), instead of A(B)
2. A would match to template, so should receive by TemplateAliasParameter.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130525/e3f0df2d/attachment.html>


More information about the Digitalmars-d mailing list