Pattern: Misuse of string::find()
Issue: -
Either inefficient or wrong usage of string::find()
. string::compare()
will be faster if string::find
result is compared with 0, because it will not scan the whole string. If your intention is to check that there are no findings in the string, you should compare with std::string::npos
.