If getResult
is a method (member function) you need to call it to compare the result, so you probably want:
if (something.getResult() == std::string("Something"))
// ...
If, on the other hand, getResult
is really a pointer to char (or pointer to const char), you need to convert one of the things you're comparing to string
before the comparison):
if (getResult == std::string("Something"))
or:
if (std::string(getResult) == "something))
IMO, this should almost never be necessary -- instead of starting with a pointer to [const] char, then converting, you should normally use std::string
throughout.