-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Add uncopyable.h, class uncopyable #985
Add uncopyable.h, class uncopyable #985
Conversation
I don't see a way to add a unit test for this feature. It's a convenience feature which being applied incorrectly would not compile. |
If you prefer a unit test including a dummy use of this class (non-functional feature), I can add it. |
uncopyable& operator=(uncopyable const&) = delete; | ||
|
||
protected: | ||
uncopyable() = default; |
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.
I've see comments online that Scott Meyers also adds the destructor in his 'Effective C++' book.
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.
I.e. a non-virtual public "=default" destructor?
Is there a reasoning behind it?
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.
It looks like it is intended to make the destructor protected
, rather than default public
.
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.
Added the destructor.
I have sometimes added a commented out unit test that contains 'uncompilable' code, with a surrounding comment that the test should fail to compile if uncommented. |
I also sometimes do this for |
I just added the destructor as discussed, and unit tests, including disabled code that intentionally wouldn't compile. |
0ecab77
into
ETLCPP:pull-request/#985-Add-uncopyable.h-class-uncopyable
* Add uncopyable.h, class uncopyable * Added destructor and unit tests for etl::uncopyable
No description provided.