MoveConstructible
Suppose thatTis a object or reference type to be supplied by a c++ program instantiating a templateudenotes an identifierrvdenotes an rvalue of type T
T is MoveConstructible when the following is true:
| Expression | Post-conditions |
|---|---|
T u = rv; |
The value of u is equivalent to the value of rv before the initialization.
|
T(rv) |
The value of T(rv) is equivalent to the value of rv before the initialization.
|
Note that there is no condition on the value of rv after these operations
CopyAssignable
Suppose that:Tis a object or reference type to be supplied by a c++ program instantiating a templateudenotes an identifiervdenotes an lvalue of type (possibly const) T or an rvalue of type const T.
T is CopyAssignable when the following is true:
| Expression | Return type | Return value | Post-conditions |
|---|---|---|---|
t = v |
T& |
t |
The value of t is equivalent to the value of v.
The value of v is unchanged.
|
CopyConstructible
Suppose that:Tis a object or reference type to be supplied by a c++ program instantiating a templateudenotes an identifiervdenotes an lvalue of type (possibly const) T or an rvalue of type const T.
T is CopyConstructible when the following is true:
- The type
Tis MoveConstructible.
| Expression | Post-conditions |
|---|---|
T u = v; |
The value of u is equivalent to the value of v.
The value of v is unchanged.
|
T(v) |
The value of T(v) is equivalent to the value of v.
The value of v is unchanged.
|
Additionally, the xpression v.~T() must be valid, and for lvalue v,
the expression &v must have type T* or const T*
and evaluate to the address of v.
We say that a type
T is MoveAssignable when the following is true:
| Expression | Return type | Return value | Post-conditions |
|---|---|---|---|
t = rv |
T& |
t |
If t and rv do not refer to the same object,
the value of t is equivalent to the value of rv
before the assignment.
The new value of rv is unspecified.
|
We say that a type T is DefaultConstructible when the following is true:
| Expression | Post-condition |
|---|---|
T t; |
object t is default-initialized |
T u{}; |
object u is value-initialized or aggregate-initialized |
T()T{} |
an object of type T is value-initialized or aggregate-initialized |