Hi, all
I got stuck by the erase function usage.
here is my code:
//A is my class
//this function is used for judge weather there is a punctuation in //the word and get rid of it.
void A::isnotpuct(const string& wordlist) const
{
size_t len = wordlist.length() +1;
for(size_t j=0; j<wordlist.length();j++)
{ if(ispunct(wordlist[j]))
{
size_t lenend = len-j;
wordlist.erase(wordlist.begin()+j,wordlist.end()-lenend);
}
}
}
But i got the error information:
error C2663: 'std::basic_string<_Elem,_Traits,_Ax>::erase' : 3 overloads have no legal conversion for 'this' pointer
What does that mean??
How i could correct it??
Many thanks.