std::is_swappable_with,std::is_swappable,std::is_nothrow_swappable_with, (3) - Linux Manuals
std::is_swappable_with,std::is_swappable,std::is_nothrow_swappable_with,: std::is_swappable_with,std::is_swappable,std::is_nothrow_swappable_with,
NAME
std::is_swappable_with,std::is_swappable,std::is_nothrow_swappable_with, - std::is_swappable_with,std::is_swappable,std::is_nothrow_swappable_with,
Synopsis
Inherited from std::integral_constant
Defined in header
template<
struct is_swappable_with;
template<
struct is_swappable;
template<
struct is_nothrow_swappable_with;
template<
struct is_nothrow_swappable;
1)
swap(std::declval<U>(), std::declval<T>())
context after using std::swap;
equal true. Otherwise, value is false. Access checks are performed as if from a
context unrelated to either type.
2)
type with a cv-qualifier-seq or a ref-qualifier), provides a member constant value
equal to false. Otherwise, provides a member constant value equal to
std::is_swappable_with<T&, T&>::value
3)
exceptions
4)
T and U shall each be a complete type,
unknown bound. Otherwise, the behavior is undefined.
If an instantiation of a template above depends, directly or indirectly, on an
incomplete type, and that instantiation could yield a different result if that type
were hypothetically completed, the behavior is undefined.
template
inline constexpr bool is_swappable_with_v
U>::value;
template
inline constexpr bool is_swappable_v
template
inline constexpr bool is_nothrow_swappable_with_v
is_nothrow_swappable_with<T, U>::value;
template
inline constexpr bool is_nothrow_swappable_v
is_nothrow_swappable<T>::value;
Member constants
value
[static] Member functions
operator bool converts the object to bool, returns value
operator()
(C++14) Member types
Type
value_type bool
type 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