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

Ahuzhgairl bulletproofchest at gmail.com
Sat May 25 05:43:41 PDT 2013


C++ example, works:

template <class> struct A;
template <template <class> class X, class Y> struct A<X<Y>> {};

template <class> struct B;

int main() {
     A<B<int>> a;
}



But the following does not work:

struct Foo {};
template <class> struct B { Foo x; }

template <nontype P> struct A;
template <auto M, auto C, nontype P> struct A<M C::*P> {}

int main() {
     A<&B<int>::x> a;
}


D should be able to do both.


More information about the Digitalmars-d mailing list