-
Notifications
You must be signed in to change notification settings - Fork 138
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
Refactor[BMQT]: make Subscription rule-of-three complaint #370
Refactor[BMQT]: make Subscription rule-of-three complaint #370
Conversation
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.
Thank you for fixing this.
#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \ | ||
defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) | ||
/// Assign to this object the value of the specified `rhs` object. | ||
/// After performing this action, the `rhs` object will be left in a | ||
/// valid, but unspecified state. | ||
Subscription& operator=(Subscription&& rhs); | ||
#endif |
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.
We should probably use bslmf::MovableRef
instead of preprocessor guards here
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.
On the other hand, what do you think about removing explicit copy constructor and assignment at all? It should deal with the warnings, and also we re-implemented the default one anyway. We don't use allocators for these classes, so we don't need to implement allocator-aware assignment.
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 proposed change is in the latest commit
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.
This would also work, for some reason I thought there was an explicit destructor here that was forcing us into a rule-of-3/rule-of-5 situation
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
ca40d2d
to
e309272
Compare
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.
See https://bloomberg.github.io/bde-resources/doxygen/bde_api_prod/classbslmf_1_1MovableRef.html for how we can rewrite this to have rvalue references work on platforms with >=C++11 while also having fake moves on C++03
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
Removes ~400 lines from the build log
Compliant to https://en.cppreference.com/w/cpp/language/rule_of_three