Open saxbophone opened 1 year ago
This can't be done until #133 has been done, as the current data structure lacks a move assignment operator, but std::vector does have one.
FWIW, there is no performance benefit in moving a digit individually, but there is a potential performance benefit in moving the digits container itself, as that prevents a copy. When I build sharray (which I intend to use instead of vector), I should definitely include a move constructor and move-assignment operator.
In some methods (friend operators), we create a temporary inside the function which is never used again before returning. We assign our digits from these members' digits. These variables can be moved, but I'm not sure if the compiler is smart enough to use move semantics here. We might need to use
std::move()
on each one to gain the benefits of move semantics in these places, and if it avoids a copy then it will likely increase performance.I have marked the places where I think this can be done in the linked commit. Not sure I caught all of them, there may be others in the math support header...