If I understand the documentation correctly, std::string::replace may replace some part of a string even with a longer string:
std::string s("hello");
s.replace(s.begin() + 1, s.end() - 1, ".....");
std::cout << s; // prints "h.....o"
This might require reallocation if the capacity is not high enough for a new string. However, the exception specification for replace in the C++11 Standard does mention only out_of_range and length_error exceptions.
In the current draft, there are additionally specified exceptions thrown by the allocator's allocate member function [string.replace.8.3]:
Throws: ...
— any exceptions thrown by
allocator_traits<Allocator>::allocate.
I wonder why these exceptions are not specified in C++11? May library functions throw additional exceptions not specified in the Throws: clause?