var.this
(ref return scope inout var rhs) inout scope @safeCopy constructor for same-constness copies (mutable→mutable,
- const→const, immutable→immutable, and compiler-generated
inoutcopies - in structs that embed
var): shallow payload copy, matching the - documented
var a = b;aliasing semantics.
(ref return scope const var rhs) @safeCopy constructor from a const var into a mutable one: deep copy. A shallow blit would hand back a mutable alias to the const payload, letting @safe callers mutate "const" data (and race on shared snapshots).
(ref return scope immutable var rhs) @safeCopy constructor from an immutable var into a mutable one: deep copy (see the const overload).
(ref return scope const var rhs) const scope @safeCopy constructor from a const var into a const one: shallow copy. A const destination cannot be used to mutate the payload, so aliasing is sound.
(ref return scope immutable var rhs) const scope @safeCopy constructor from an immutable var into a const one: shallow copy (a const view of immutable data; nobody can mutate it).
(T arg) @safeConstruct a var from another value arg.
This constructor delegates to opAssign for non-var arguments to normalize behavior. var-to-var copies are handled exclusively by the copy constructors above (D forbids an rvalue constructor alongside a copy constructor).