这段代码在 VC6 中编译文件,但在 VS 2008 中它给出了错误。谁能告诉我为什么?我猜这是因为你不能再比较指向 NULL 的指针(这是 0 的 typedef)。如果是这样,我如何在 VC9 中进行这种比较?
for ( std::vector<aCattrBase*>::iterator iT = attrLst.begin(); iT < attrLst.end(); iT++)
{
if ( (iT != NULL) && (*iT != NULL) ) //Error: C2678
{
//code
}
}
错误 C2678:二进制“!=”:未找到采用“std::_Vector_iterator<_Ty,_Alloc>”类型的左侧操作数的运算符(或没有可接受的转换)