我收到警告#12367 when running Build | Build Solution for Intel Static Analysis
,但我的代码看不到问题。任何人的想法?
警告 #12367:由于隐式类型转换,在调用“std::_Vector_iterator > > std::vector >::erase(std::_Vector_const_iterator > >)”中对作为实际参数 2 传递的对象进行切片
pragma warning(suppress: 4995)
#include <vector>
class __declspec(dllexport) MxPluginLib //nothing special here, not derived class etc
{
public:
// ...
private:
// ... nothing special here
};
class __declspec(dllexport) MxPluginManager
{
public:
//...
private:
#pragma warning(suppress: 4251)
std::vector<MxPluginLib *> _Libs;
};
bool MxPluginManager::DeleteNextUnselected()
{
bool erased = false;
size_t cnt = _Libs.size();
if (cnt > 0 )
{
for (size_t x = 0; x < cnt; x++)
{
if (_Libs[x]->GetSelection() == false)
{
delete _Libs[x];
_Libs[x] = '\0';
_Libs.erase(_Libs.begin()+x); //THIS IS WHERE THE WARNING IS GENERATED
erased = true;
break;
}
}
}
return erased;
}