While debugging my code, I've noticed a change in stored iterator, pointed to begin(), after every 4 or 5 call to += operator on a string (what it points to, isn't even in the string itself!). Here's what my code looks like:
for (auto ch=word.begin(); ch!=word.end(); ++ch) {
  // on a condition, the following loop starts
  // ch == word.begin()
  for (int i=0; ...) {
    string_view tmp = arr[i];
    word += tmp;
  }
  // ch is no longer equal to word.begin()
}
While reassigning ch to word.begin() after second loop fixed my issue, I'm wondering why this has happened. I couldn't find anything on the internet.
 
    