cpp/named req/Swappable

Any lvalue or rvalue of this type can be swapped with any lvalue or rvalue of some other type, using unqualified function call in the context where both std and the user-defined s are visible.

Requirements
Type U is swappable with type T if, for any object u of type U and any object t of type T,

Many standard library functions (for example, many algorithms) expect their arguments to satisfy, which means that any time the standard library performs a swap, it uses the equivalent of.

Typical implementations either @1@ Define a non-member swap in the enclosing namespace, which may forward to a member swap if access to non-public data members is required @2@ Define a friend function in-class (this approach hides the class-specific swap from name lookup other than ADL)