Repository navigation
refactor: add move constructor and move assignment operator to ValueDesc - #3150
Conversation
Note: sadly the usage is low. By adding debug messages on copy constructor and assignment operator, it can be seen there is *a lot* of copy while clicking around, moving mouse or even after a Alt+Tab to change to other application.
| } | ||
|
|
||
| // move | ||
| ValueDesc(ValueDesc&& other) noexcept |
There was a problem hiding this comment.
nit: lets avoid unnecessary default constructions followed by assignments
ValueDesc(ValueDesc&& other) noexcept
: layer(std::move(other.layer)),
name(std::move(other.name)),
parent_value_node(std::move(other.parent_value_node)),
index(other.index),
waypoint_time(std::move(other.waypoint_time)),
canvas(std::move(other.canvas)),
id_changed_connection(std::move(other.id_changed_connection)),
sub_names(std::move(other.sub_names)),
parent_desc(std::move(other.parent_desc)),
links_count(other.links_count)
{
other.parent_desc = nullptr;
other.links_count = 0;
}
There was a problem hiding this comment.
I was just placing everything in a single method to avoid mistakes. For example, someone adds a new "field"/property to ValueDesc and forget to add to both move-related methods.
And these methods declarations are only needed due to this explicit pointer parent_desc :/
This is interesting. I'll try to check that too. |
It looks like basically all the calls come from |
|
Merged. Thank you! |
Note: sadly the usage is low.
By adding debug messages on copy constructor and assignment operator, it can be seen there is a lot of copy while clicking around, moving mouse or even after a Alt+Tab to change to other application.