SharedObject: delete unused methods#10456
Conversation
lib/base/shared-object.hpp
Outdated
| SharedObject(const SharedObject&) = delete; | ||
| SharedObject(SharedObject&&) = delete; | ||
| SharedObject& operator=(const SharedObject&) = delete; | ||
| SharedObject& operator=(SharedObject&&) = delete; |
There was a problem hiding this comment.
Wanted to do this for the new StoppableWaitGroup requested in #10397 (comment), but thought:
| inline SharedObject& operator=(SharedObject&&) | ||
| { | ||
| return *this; | ||
| } |
There was a problem hiding this comment.
what do they even exist for?
|
You don't need to delete the move constructor and assignment operator when the copy constructor and assignment operator have already been deleted (or defined non-default). See here:
An equivalent rule exists for the operator, here. So I agree absolutely with removing the definitions for shared object and defining the copy-constructor and copy-assignment operator as deleted, but for |
6d77b3f to
352ef47
Compare
lib/base/shared-object.hpp
Outdated
| SharedObject(const SharedObject&) = delete; | ||
| SharedObject(SharedObject&&) = delete; | ||
| SharedObject& operator=(const SharedObject&) = delete; | ||
| SharedObject& operator=(SharedObject&&) = delete; |
There was a problem hiding this comment.
The move constructor and move-asignment operator deletes are still unnecessary.
None of the derived classes use them, none shall have to explicitly delete them.
352ef47 to
4f351f6
Compare
None of the derived classes use them, none shall have to explicitly delete them.