[Solved] SIGABRT called when calling find() on a string element in an array [closed]
It’s pretty simple why it’s crashing when you change that line. In the version that crashes you check whether words[j].find(new_word) is equal to std::string::npos and then call s.erase(s.find(new_word), …). Of course, s.find(new_word) could still be std::string::npos, and string::erase throws an exception when the first argument is out of range. In the version that you say … Read more