Also, I forgot to mention, I wouldn’t discount the benefit from bypassing reference counting by moving instead of copying. Calling vtkObjectBase::Register
is a lot of jumps and virtual calls that will slow things down and trash the instruction cache, vs a move which just copies 8 bytes and sets the source to nullptr
.
Plus, these move operations not only bypass reference counting completely, but they also enforce noexcept
semantics, which enable a ton of compiler optimizations and allow things like vtkNew
to be stored in e.g. std::vector
, which is a nice added benefit.