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:
*thiscontains the characters that were ins,scontains 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:
*thiscontains the same sequence of characters thatwerewas ins,scontains the same sequence of characters thatwerewas in*this.