为什么这段代码给我错误:向量迭代器不兼容
这段代码被追溯到 Rogue Wave 文件 tpordvec.h
std::vector<T*> v;
const T* a // Where T is a template Class
for (std::vector<T*>::iterator p = v.begin(); p != v.end(); p++)
{
if (**p == *a)
{
T* temp = *p;
if ( v.erase(p) == v.end()) //ASSERTION ERROR HERE
return NULL;
return temp;
}
}