Skip to content
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

Apply rule-of-5 to ESPreFunctorDecorator #44483

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion FWCore/Framework/interface/ESPreFunctorDecorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ namespace edm {
class ESPreFunctorDecorator {
public:
ESPreFunctorDecorator(const TFunctor& iCaller) : caller_(iCaller) {}
const ESPreFunctorDecorator& operator=(const ESPreFunctorDecorator&) = delete; // stop default
ESPreFunctorDecorator() = delete;
ESPreFunctorDecorator(ESPreFunctorDecorator&&) = default;
ESPreFunctorDecorator(ESPreFunctorDecorator const&) = default;
ESPreFunctorDecorator& operator=(const ESPreFunctorDecorator&) = delete; // stop default
ESPreFunctorDecorator& operator=(ESPreFunctorDecorator&&) = delete;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to double check, this class is copyable and movable via constructor, but not via assignment? I.e. assigning to a caller_ (when not initializing it) is what we want to avoid? But copying caller_ as such is fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code stopped the regular op= but the compiler warning complained about the default copy constructor. To make the code work, I had to require the copy constructor (and figured move constructor would be fine). Then I just picked the move op= to be treated like the regular op=.


//virtual ~ESPreFunctorDecorator();

Expand Down