I have this code:
template <typename A> class templatedclass { public: using type = templatedclass; }; template <typename A> class sinkstuff { public: void print() { cout << "generic sinkstuff"; } }; template <typename A> class sinkstuff <templatedclass<A>> { public: void print() { cout << "partiallyspecialized sinkstuff"; } }; template <typename NtoA> struct pass_parameter : sinkstuff<typename templatedclass<NtoA>::type> {}; int main() { pass_parameter<int> obj; obj.print(); cout << is_same<templatedclass<int>, typename templatedclass<int>::type>::value; // 1, yes } I always thought the "using directive" was a typedef on steroids. How come I can use "templatedclass<int>::type" without specifying the parameter again, i.e. "templatedclass<int>::type<int>" ?
Isn't "using type = templatedclass" just a textual substitution? Am I missing something?