-
Notifications
You must be signed in to change notification settings - Fork 596
SharedObject: delete unused methods #10456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.