Concept Subspace :: sus :: mem :: Move
template <class T>concept Move
requires
std::is_move_constructible_v<
std::remove_const_t<std::remove_reference_t<T>>>
std::is_move_assignable_v<std::remove_const_t<std::remove_reference_t<T>>>
A Move
type can be moved-from to construct a new object of the same type
and can be assigned to by move.
A type satisfies Move
by implementing a move constructor and assignment
operator.
This concept tests the object type of T
, not a reference type T&
or
const T&
.
A type that is Copy
is also Move
. However the type can opt out by
explicitly deleting the move constructor and assignment operator. This is
not recommended, unless deleting the copy operations too, as it tends to
break things that want to move-or-fallback-to-copy.
Example
struct S {
S() = default;
S(S&&) = default;
S& operator=(S&&) = default;
};
static_assert(sus::mem::Move<S>);