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

Ahuzhgairl bulletproofchest at gmail.com
Sat May 25 12:36:57 PDT 2013


Kenji,
Thank you much for the '.C' alias support, Amazed to see there 
could be some action so quick!


Could we please look at the nontype-as-primary-template?

How can we deduce all of the dependent types from a non-type 
template parameter, if it's the only parameter of the primary 
template?



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

template <nontype P> struct A;
// P is the primary-template param

template <auto M, auto C, nontype P> struct A<M C::*P> {
     // Given the call in main,
     // M is deduced as Foo
     // C is deduced as B<int>
     // P was passed successfully and we know the types that make 
it up.
}

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


More information about the Digitalmars-d mailing list