我試圖申報AN迭代器,但我有問題。 我使用VC++ 2010迭代器聲明與VC++
#include<iterator>
#include<map>
using namespace std;
using std::regex_replace;
template <class KTy, class Ty>
void PrintMap(map<KTy, Ty> map)
{
**:iterator iterator;
for (iterator p = map.begin(); p != map.end(); p++)
cout << p->first << ": " << p->second << endl;**
}
的錯誤信息是:
錯誤1錯誤C2143:語法錯誤:缺少 ';'之前「:」(用於:迭代器迭代器)
錯誤\t 1個\t錯誤C2143:語法錯誤:缺少 ';'之前':'(for:迭代迭代器;) – user27995