samedi 29 juin 2019

Std::string::iterator doesn't return char

I wanted to clear string from unwanted chars, and I tried to iterate it through a loop like this.

for(auto it=numer.begin(); it!=numer.end(); ++it)
    {
        if(it*=='-') numer.erase(it);
    }

The error is: "expected primary-expression before '=' token"; I could, of course, I could do this with [] operator. But I am wondering why it doesn't work. I appreciate your help.

Aucun commentaire:

Enregistrer un commentaire