2013/5/26 Ahuzhgairl <bulletproofchest@gmail.com>
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;
}

Hmm. Currently D can specify specType for alias template parameter.

struct X(alias int x) {}   // matches only when the symbol x has the type int
void main()
{
    int a;
    X!a xa; // match OK
    long b;
    X!b xb; // match NG
}

But, compiler does not allow parameterize of specType.

struct Foo {}
struct B(T) { static Foo x; }

//struct A(alias P) {}

struct A(alias M* P, M)    // matches only when the symbol P has the type M*
//struct A(alias C.M* P, M, C)
{
}

void main()
{
    auto mp = &B!(B!int).x;
    A!mp a;   // does not match...
}

I think it should be allowed.

Kenji Hara