-
Notifications
You must be signed in to change notification settings - Fork 406
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
Make ScratchMemorySpace semi-regular #3309
Make ScratchMemorySpace semi-regular #3309
Conversation
Of course they are not defined. That's the old way to delete them. |
I was trying to understand the Travis problems with #3306 and was stumbling over this class. |
Why did you close? The issue with your PR is not the changes you propose per se, but how you present them. |
ScratchMemorySpace(); | ||
ScratchMemorySpace& operator=(const ScratchMemorySpace&); |
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.
ScratchMemorySpace() = delete;
ScratchMemorySpace& operator=(const ScratchMemorySpace&) = 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.
This is saying we want ScratchMemorySpace to be copy constructible but not copy assignable. Is that correct?
I'd much prefer the Rule of 5 here, which also has the advantage of not needing to explicitly delete the default constructor.
5a6617b
to
77ef660
Compare
Yes, we need it to be copy constructible for TeamMembers to be copy constructible. |
Given that all the member variables are either |
Since that's what I originally proposed, that's fine with me. 🙂 |
any calls on a default constructed ScratchMemorySpace get_shmem* don't invoke ub
Initialize member variables for default constructed ScratchMemorySpace
You need to apply clang-format |
edc3dcb
to
1937ca0
Compare
With the latest changes, |
edited Making
ScratchMemorySpace
easier to use and to reason about since could not think of any good reason not to do so. The copy-assignment was intentionally deleted in the past but there was no comment explaining that choice.These seem to not be defined.Since there is another constructor deleting the private default constructor doesn't seem to be any effect. I could be convinced that the copy constructor should be deleted, though.
Don't use the pre-C++11 way to delete functions but use the rule of 5 instead and also allow move assignment/move construction.