checking std::string before compare code example Example: compare string c++ int compare (const string& str) const;