This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 27.4.3.7.8 [string.swap] Status: CD1 Submitter: Beman Dawes Opened: 2005-12-14 Last modified: 2016-11-12
Priority: Not Prioritized
View all other issues in [string.swap].
View all issues with CD1 status.
Discussion:
std::string::swap currently says for effects and postcondition:
Effects: Swaps the contents of the two strings.
Postcondition:
*this
contains the characters that were ins
,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.
Proposed resolution:
Effects: Swaps the contents of the two strings.Postcondition:
*this
contains the same sequence of characters thatwerewas ins
,s
contains the same sequence of characters thatwerewas in*this
.