std::experimental::ranges::is_swappable_with,std::experimental::ranges::is_swappable, (3) Linux Manual Page
std::experimental::ranges::is_swappable_with,std::experimental::ranges::is_swappable, – std::experimental::ranges::is_swappable_with,std::experimental::ranges::is_swappable,
Synopsis
Defined in header<experimental / ranges / type_traits>
template <class T, class U>
(1)(ranges TS)
struct is_swappable_with;
template <class T>
(2)(ranges TS)
struct is_swappable;
template <class T, class U>
(3)(ranges TS)
struct is_nothrow_swappable_with;
template <class T>
(4)(ranges TS)
struct is_nothrow_swappable;
1)
ranges::swap(std::declval<U>(), std::declval<T>())
as an unevaluated operand, provides the member constant value 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
ranges::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.
template <class T, class U> (1) (ranges TS)
constexpr bool is_swappable_with_v = is_swappable_with<T, U>::value;
template <class T> (2) (ranges TS)
constexpr bool is_swappable_v = is_swappable<T>::value;
template <class T, class U>
constexpr bool is_nothrow_swappable_with_v = (3) (ranges TS)
is_nothrow_swappable_with<T, U>::value;
template <class T>
constexpr bool is_nothrow_swappable_v = (4) (ranges TS)
is_nothrow_swappable<T>::value;
Inherited from std::integral_constant
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 ranges::is_swappable_with<T,U>::value compiles
and evaluates to true.
Examples
See also
Swappable
SwappableWith
is_swappable_with
is_swappable
is_nothrow_swappable_with checks if objects of a type can be swapped with objects of
is_nothrow_swappable
(C++17)
(C++17)
(C++17)
(C++17)
