std::swappable, std::swappable_with
Min standard notice:
Header: <concepts>
The concept swappable
# Declarations
template< class T >
concept swappable =
requires(T& a, T& b) {
ranges::swap(a, b);
};
(since C++20)
template< class T, class U >
concept swappable_with =
std::common_reference_with<T, U> &&
requires(T&& t, U&& u) {
ranges::swap(std::forward<T>(t), std::forward<T>(t));
ranges::swap(std::forward<U>(u), std::forward<U>(u));
ranges::swap(std::forward<T>(t), std::forward<U>(u));
ranges::swap(std::forward<U>(u), std::forward<T>(t));
};
(since C++20)