Normally this move-assignment would take a SiteParameters &&site_parameters argument like the move constructor above it:
|
SiteParameters &operator=( |
|
SiteParameters &site_parameters) // Changed on my own from no & to && (from DevDat other to &&other) |
same here:
|
SiteSystem & |
|
operator=(SiteSystem &site_system) // Changed on my own from no & to && (from DevDat other to &&other) |
As written it does work just fine as a move-assignment operator, e.g. assuming we have SiteParameters a and b, we can assign the contents of a to b
but it also acts like a copy-assignment operator (that steals the original object's data), so we can also do this::
but the user would probably be surprised to find a has been altered in this code.
Instead with && the second example won't compile, since a here is an l-value/not a temporary, and there is no copy assignment operator defined.
Normally this move-assignment would take a
SiteParameters &&site_parametersargument like the move constructor above it:LatticeModelSimulationLib/include/lattice_model_impl/site/site.hpp
Lines 47 to 48 in 846704b
same here:
LatticeModelSimulationLib/include/lattice_model_impl/site/site.hpp
Lines 154 to 155 in 846704b
As written it does work just fine as a move-assignment operator, e.g. assuming we have
SiteParametersaandb, we can assign the contents of a to bbut it also acts like a copy-assignment operator (that steals the original object's data), so we can also do this::
but the user would probably be surprised to find
ahas been altered in this code.Instead with
&&the second example won't compile, sinceahere is an l-value/not a temporary, and there is no copy assignment operator defined.