You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the Cpp17Swappable requirements ([swappable.requirements]) doesn't seem to exclude self-swaps or side effects in them, and no special case is specified for self-swaps of pair.
Perhaps we should just unconditionally swap members.
We looked at this during the weekly maintainer meeting and agree that the Standardese says we should be directly swapping both members without a self-address check.
@CaseyCarter remembered that this is vaguely related to #1485 but is distinct.
Describe the bug
Currently, self-swaps of
pair
are no-op:STL/stl/inc/utility
Lines 441 to 460 in 9aca224
However, the Cpp17Swappable requirements ([swappable.requirements]) doesn't seem to exclude self-swaps or side effects in them, and no special case is specified for self-swaps of
pair
.Perhaps we should just unconditionally swap members.
Command-line test case
Godbolt link.
Expected behavior
The code snippet compiles.
The text was updated successfully, but these errors were encountered: