Skip to content

CopyAssignable

Specifies that an instance of the type can be copy-assigned from an lvalue expression.

The type T satisfies CopyAssignable if

  • The type T satisfies MoveAssignable, and

Given

  • t, a modifiable lvalue expression of type T,
  • v, an lvalue expression of type T or const T or an rvalue expression of type const T.

The following expressions must be valid and have their specified effects.

ExpressionReturn typeReturn valuePost-conditions
t=vT&tThe value of t is equivalent to the value of v.
The value of v is unchanged.
std::is_copy_assignable
(since C++11)
std::is_trivially_copy_assignable
(since C++11)
std::is_nothrow_copy_assignable
(since C++11)

checks if a type has a copy assignment operator

(class template)
assignable_from
(since C++20)

specifies that an object of a type can be default constructed

(concept)