...
Do not pass an out-of-range value as an argument to std::string::opperatoroperator[](). Similarly, do not call std::string::back() or std::string::front() on an empty string. This rule is a specific instance of CTR50-CPP. Guarantee that container indices and iterators are within the valid range.
...