void StudentList::DeleteStudent(string s)
{
vector <Student> ::iterator p1;
p1=stuArr.begin();
if (stuArr.size()==0)
{
cout<<"当前列表没有元素可以删除"<<endl;
}
else
{
while (p1!=stuArr.end())
{
if(p1->GetName()=s)
{
stuArr.erase(p1);
}
}
}
{
vector <Student> ::iterator p1;
p1=stuArr.begin();
if (stuArr.size()==0)
{
cout<<"当前列表没有元素可以删除"<<endl;
}
else
{
while (p1!=stuArr.end())
{
if(p1->GetName()=s)
{
stuArr.erase(p1);
}
}
}
}
编译C:\Documents and Settings\Administrator\桌面\实验9\实验9\StudentList.cpp(27) : error C2451: conditional expression of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' is illegal
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.出错
求大神讲解