mardi 3 juillet 2018

Compilation error using string::pop_back()

I am trying to remove last character of string. Since I am using c++11 I am using pop_back(). This is my code:

std::string ipAddresses = response.substr(response.find_first_of(",")+1);
responseVector.push_back( ipAddresses.pop_back() );

For some reason I am getting compilation error:

 error: invalid use of void expression
 responseVector.push_back( ipAddresses.pop_back() );

Could someone tell me how to fix this?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire