Given an empty string, operator(0) shows a debug assertion error "string subscript out of range".The C++ standard (both before and after C++11) specify that operator(size()) should return a reference to the value CharT() (the null character):See http://en.cppreference.com/w/cpp/string/basic_string/operator_at :If pos==size(), The const version returns a reference to the character with value CharT() (the null character). (until C++11) Both versions returns a reference to the character with value CharT() (the null character). Modifying the null character through non-const reference results in undefined behavior. (since C++11)In other words, no assertion error should be reported when pos==size() .
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Operating System Language