Once again I want C ++ to have a stronger typedefs:
#include <vector>
template<typename T>
struct A {
typedef std::vector<T> List;
};
template<typename T>
void processList(typename A<T>::List list) {
}
int main() {
A<int>::List list;
processList<int>(list);
processList(list);
}
Apparently, the compiler sees listhow std::vector<int>, and not A<int>::List, therefore, it cannot match it with the expected one A<T>::List.
In fact, this is a longer type name, often repeated, and this is a nuisance. Also, to processListaccept vectorinstead, is there a way to draw template type inference for me?
source
share