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.
535. std::string::swap specification poorly wordedSection: 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 that were was ins
,s
contains the same sequence of characters that were was in*this
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4