You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, a = b.clone() is the way to copy-assign to a value in generic code (at least once there's a default implementation for Copyable types, per #3313).
If a is uninitialized, that's perfectly optimal. When the value is already initialized, assignment can often be done with fewer allocations; a list or chunked list can be partially or fully reused, and even a vector/string can often be reused if it's big enough.
So, something like this (with a default impl for Cloneable types):
At the moment,
a = b.clone()
is the way to copy-assign to a value in generic code (at least once there's a default implementation forCopy
able types, per #3313).If
a
is uninitialized, that's perfectly optimal. When the value is already initialized, assignment can often be done with fewer allocations; a list or chunked list can be partially or fully reused, and even a vector/string can often be reused if it's big enough.So, something like this (with a default impl for
Clone
able types):There's no need for any operator overload, since
a = b
is just an implicit copy or a move.The text was updated successfully, but these errors were encountered: