As the title says:
Does the standard guarantee, that std::string::resize will not do anything, if the new size is the same as the old one?
Of course, I can test it, but it could be UB, so testing will not work here.
In cppreference.com and cplusplus.com, the doc says nothing about this case
Example:
std::string s( "asd" );
// s.size() is 3
s.resize( 3 ); // will this affect **somehow** the string?
No, there are no guarantees. An implementation could reallocate the string to a new buffer, to reduce its
capacity().The standard says: