std::is_swappable_with, std::is_swappable, std::is_nothrow_swappable_with, std::is_nothrow_swappable
Min standard notice:
Header: <type_traits>
- If the expressions swap(std::declval
(), std::declval()) and swap(std::declval(), std::declval ()) are both well-formed in unevaluated context after using std::swap; (see Swappable), provides the member constant value equal true. Otherwise, value is false.
# Declarations
template< class T, class U >
struct is_swappable_with;
(since C++17)
template< class T >
struct is_swappable;
(since C++17)
template< class T, class U >
struct is_nothrow_swappable_with;
(since C++17)
template< class T >
struct is_nothrow_swappable;
(since C++17)
# Notes
This trait does not check anything outside the immediate context of the swap expressions: if the use of T or U would trigger template specializations, generation of implicitly-defined special member functions etc, and those have errors, the actual swap may not compile even if std::is_swappable_with<T, U>::value compiles and evaluates to true.
# Example
This section is incompleteReason: no example