-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Normally this move-assignment would take a SiteParameters &&site_parameters argument like the move constructor above it:
LatticeModelSimulationLib/include/lattice_model_impl/site/site.hpp
Lines 47 to 48 in 846704b
| SiteParameters &operator=( | |
| SiteParameters &site_parameters) // Changed on my own from no & to && (from DevDat other to &&other) |
same here:
LatticeModelSimulationLib/include/lattice_model_impl/site/site.hpp
Lines 154 to 155 in 846704b
| 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
b = std::move(a);
but it also acts like a copy-assignment operator (that steals the original object's data), so we can also do this::
b = a;
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.