std::Assignable
Defined in header <concepts>


template< class LHS, class RHS > concept Assignable = 
(since C++20)  
The concept Assignable<LHS, RHS>
specifies that an expression of the type and value category specified by RHS
can be assigned to an lvalue expression whose type is specified by LHS
.
Given

lhs
, an lvalue that refers to an objectlcopy
such that decltype((lhs)) isLHS
, 
rhs
, an expression such that decltype((rhs)) isRHS
, 
rcopy
, a distinct object that is equal torhs
,
Assignable<LHS, RHS>
is satisfied only if
 std::addressof(lhs = rhs) == std::addressof(lcopy) (i.e., the assignment expression yields an lvalue referring to the left operand);
 After evaluating lhs = rhs:

lhs
is equal torcopy
, unlessrhs
is a nonconst xvalue that refers tolcopy
(i.e., the assignment is a selfmoveassignment),  if
rhs
is a glvalue: If it is a nonconst xvalue, the object to which it refers is in a valid but unspecified state;
 Otherwise, the object it refers to is not modified;

[edit] Equality preservation
An expression is equality preserving if it results in equal outputs given equal inputs.
 The inputs to an expression consist of its operands.
 The outputs of an expression consist of its result and all operands modified by the expression (if any).
Every expression required to be equality preserving is further required to be stable: two evaluations of such an expression with the same input objects must have equal outputs absent any explicit intervening modification of those input objects.
Unless noted otherwise, every expression used in a requiresexpression is required to be equality preserving and stable, and the evaluation of the expression may only modify its nonconstant operands. Operands that are constant must not be modified.
[edit] Notes
Assignment need not be a total function. In particular, if assigning to some object x
can cause some other object y
to be modified, then x = y is likely not in the domain of =
. This typically happens if the right operand is owned directly or indirectly by the left operand (e.g., with smart pointers to nodes in an nodebased data structure, or with something like std::vector<std::any>).
[edit] See also
(C++11)(C++11)(C++11) 
checks if a type has a assignment operator for a specific argument (class template) 