The docs for the string erase(pos,len) function doesn't specify very clearly what exactly happens if pos
happens to be "one-past-end" of the string. It only hints that this is not forbidden, but not mentioning specifically what this special case means.
Indeed, str.erase(str.size())
does NOT throw an exception.
What is really supposed happen in this case? This seems not mentioned anywhere explicitly.