Post · 1 min read· p. 177

C++ standard inaccuracy

First we read:

21.4.1 basic_string general requirements [string.require]

[...]

3 No erase() or pop_back() member function shall throw any exceptions.

... a few pages later:

21.4.6.5 basic_string::erase [string::erase]

basic_string<charT,traits, Allocator>& erase(size_type pos = 0, size_type n = npos);

[...]

2 Throws: out_of_range if pos > size().