Can't deduce template type
问题 I'm trying to pass an iterator as a template parameter to a template method, but the compiler complains that: error C2783: 'void Test::Assert(std::vector<T>::const_iterator)': could not deduce template argument for 'T' The code that produces the error is: #include "stdafx.h" #include <iostream> #include <vector> class Test { public: template <typename T> void Assert(typename std::vector<T>::const_iterator it) { std::cout << *it << std::endl; } }; int _tmain(int argc, _TCHAR* argv[]) { Test