std::experimental::ranges::is_swappable_with, std::experimental::ranges::is_swappable, std::experimental::ranges::is_nothrow_swappable_with, std::experimental::ranges::is_nothrow_swappable - cppreference.com (original) (raw)
Defined in header <experimental/ranges/type_traits> | ||
---|---|---|
template< class T, class U > struct is_swappable_with; | (1) | (ranges TS) |
template< class T > struct is_swappable; | (2) | (ranges TS) |
template< class T, class U > struct is_nothrow_swappable_with; | (3) | (ranges TS) |
template< class T > struct is_nothrow_swappable; | (4) | (ranges TS) |
If
T
is not a referenceable type (i.e., possibly cv-qualified void or a function type with a cv-qualifier-seq or a ref-qualifier), provides a member constantvalue
equal to false. Otherwise, provides a member constantvalue
equal to ranges::is_swappable_with<T&, T&>::value.Same as (1), but evaluations of both expressions from (1) are known not to throw exceptions.
Same as (2), but uses is_nothrow_swappable_with.
T
and U
shall each be a complete type, (possibly cv-qualified) void, or an array of unknown bound. Otherwise, the behavior is undefined.
Contents
[edit] Helper variable templates
template< class T, class U > constexpr bool is_swappable_with_v = is_swappable_with<T, U>::value; | (1) | (ranges TS) |
---|---|---|
template< class T > constexpr bool is_swappable_v = is_swappable<T>::value; | (2) | (ranges TS) |
template< class T, class U > constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<T, U>::value; | (3) | (ranges TS) |
template< class T > constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<T>::value; | (4) | (ranges TS) |
Inherited from std::integral_constant
Member constants
| | true if T is swappable with U, false otherwise (public static member constant) | | --------------------------------------------------------------------------------- |
Member functions
| | converts the object to bool, returns value (public member function) | | ---------------------------------------------------------------------- | | | returns value (public member function) |
Member types
[edit] 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 ranges::is_swappable_with<T,U>::value
compiles and evaluates to true.