|
|
|
Defined in header <concepts> | ||
template<class T> concept swappable= | (1) | (since C++20) |
template<class T,class U> concept swappable_with= | (2) | (since C++20) |
The conceptswappable<T>
specifies that lvalues of typeT
are swappable.
The conceptswappable_with<T, U>
specifies that expressions of the type and value category encoded byT
andU
are swappable with each other.swappable_with<T, U>
is satisfied only if a call toranges::swap(t, u) exchanges the value oft
andu
, that is, given distinct objectst2
equal tot
andu2
equal tou
, after evaluating eitherranges::swap(t, u) orranges::swap(u, t),t2
is equal tou
andu2
is equal tot
.
Expressions declared inrequires expressions of the standard library concepts are required to beequality-preserving (except where stated otherwise).
swappable
[concept.swappable] swappable
[concept.swappable]