以下不編譯,我不能爲我的生活看到爲什麼!使用列表/迭代器愚蠢編譯錯誤(C++)
#include <list>
using namespace std;
list<char> myList;
list<int>::iterator it;
it = myList.begin();
錯誤:
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::list<_Ty>::_Iterator<_Secure_validation>' (or there is no acceptable conversion)
注意模板相關的錯誤,微軟編譯器會在錯誤消息後行打印模板參數。所以下一行將包含'with [Ty_ = int]和[Ty_ = char]'。 – MP24 2009-10-28 15:58:01