How do template aliases affect template parameter deduction?
问题 In C++03, template parameter deduction does not occur in some contexts. For example: template <typename T> struct B {}; template <typename T> struct A { typedef B<T> type; }; template <typename T> void f(typename A<T>::type); int main() { B<int> b; f(b); // ERROR: no match } Here, int is not deduced for T , because a nested type such as A<T>::type is a non-deduced context. Had I written the function like this: template <typename T> struct B {}; template <typename T> void f(B<T>); int main() {