lundi 17 septembre 2018

Cant use the void func for converting string to Uppercase directly in if statement- c++

I have void func below:

void ToUppercase(std::string & data)
{
    transform(data.begin(), data.end(), data.begin(), (int(*)(int))toupper);
}

if i use if statement like this:

if (ToUppercase(str).find("AAA") != string::npos) // Do something;

It is showing me error "expression must be a class type". Why cant i use void func directly in if statement. Somehow, it is not feasible for me to return value from ToUppercase func.

Aucun commentaire:

Enregistrer un commentaire