単純な消去を実行しようとしていますが、エラーが発生し続けます。
これが私の消去のコードスニペットです:
std::list<Mine*>::iterator iterMines = mines.begin();
for(int i = oldSizeOfMines; i >0 ; i--, iterMines++)
{
if(player->distanceFrom(*iterMines) < radiusOfOnScreen)
{
onScreen.push_back(*iterMines);
iterMines = onScreen.erase(iterMines);
iterMines--;
}
}
コンパイラメッセージが表示され続けます:
1>c:\users\owner\desktop\bosconian\code\bosconian\environment.cpp(158) : error C2664: 'std::list<_Ty>::_Iterator<_Secure_validation> std::list<_Ty>::erase(std::list<_Ty>::_Iterator<_Secure_validation>)' : cannot convert parameter 1 from 'std::list<_Ty>::_Iterator<_Secure_validation>' to 'std::list<_Ty>::_Iterator<_Secure_validation>'
1> with
1> [
1> _Ty=SpaceObject *,
1> _Secure_validation=true
1> ]
1> and
1> [
1> _Ty=Mine *,
1> _Secure_validation=true
1> ]
1> and
1> [
1> _Ty=SpaceObject *,
1> _Secure_validation=true
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
正しいイテレータを与えていると信じているので、私は困惑しています。
MineはSpaceObjectのサブクラスです(第2世代のサブクラスです)
これはそれと関係がありますか?そして、どうすれば修正できますか?