Bugzilla – Bug 2942
Add move support to Ptr
Last modified: 2018-07-06 11:11:13 EDT
Created attachment 3124 [details]
Patch to add move support to Ptr
Adding move support to Ptr in the form of the copy constructor and assignment operator can allow the compiler to avoid incrementing and decrementing the reference count. As SimpleRefCount is not implemented used atomics to manage the reference count (like std::shared_ptr) there are small performance wins by providing these methods.
Note that noexcept is added to certain functions as C++ containers will only use move operators if they guarantee no exceptions will be thrown. This means that any object managed by Ptr should never throw an exception in its destructor. This seems to be standard to the C++ std library .