不断收到此错误“向量下标超出范围”。我确定这是因为我的代码的这一部分。谁能帮我看看我做错了什么
bool set::remove(SET_ELEMENT_TYPE removalCandidate)
{
int subscript = positionOf(removalCandidate);
while( (subscript < my_size) && (my_element[subscript] != removalCandidate))
{
subscript++;
}
if(subscript = -1)
{
if(subscript == my_size)
return false;
else {
while (subscript < my_size)
{
my_element[subscript] = my_element[subscript + 1];
subscript++;
}
my_size--;
return true;
}
return false;
}
return 0;
}