Title
std::string::swap specification poorly worded
Status
cd1
Section
[string.swap]
Submitter
Beman Dawes

Created on 2005-12-14.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Effects: Swaps the contents of the two strings.

Postcondition: *this contains the same sequence of characters that were was in s, s contains the same sequence of characters that were was in *this.

Date: 2005-12-14.00:00:00

std::string::swap currently says for effects and postcondition:

Effects: Swaps the contents of the two strings.

Postcondition: *this contains the characters that were in s, s contains the characters that were in *this.

Specifying both Effects and Postcondition seems redundant, and the postcondition needs to be made stronger. Users would be unhappy if the characters were not in the same order after the swap.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2982
2005-12-14 00:00:00admincreate