Appendix C: Changes to "Define Copy, move, and destroy consistently"#2274
Open
eyalroz wants to merge 2 commits into
Open
Appendix C: Changes to "Define Copy, move, and destroy consistently"#2274eyalroz wants to merge 2 commits into
eyalroz wants to merge 2 commits into
Conversation
…eference in the "Define Copy, move, and destroy consistently" section of "Appendix C: Discussion"
Author
|
@hsutter : It's been over a year since you self-assigned this PR. Care to review it? |
shaneasd
reviewed
Jul 8, 2026
|
|
||
| **Exceptions**: When any of the special functions are declared only to make them non-public or virtual, but without special semantics, it doesn't imply that the others are needed. | ||
| In rare cases, classes that have members of strange types (such as reference members) are an exception because they have peculiar copy semantics. | ||
| In a class holding a reference, you likely need to write the copy constructor and the assignment operator, but the default destructor already does the right thing. (Note that using a reference member is almost always wrong.) |
Contributor
There was a problem hiding this comment.
The removal of the assertion that this is almost always wrong addresses #1707. My opinion is that it is therefore an improvement. However my opinion differs, it seems, from that of the editors and holds no particular sway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes regard "Appendix C: Discussion", section "Define Copy, move, and destroy consistently".
This section is somewhat of a jumble, mixing some fragments from other sources, and some which seem like parts of drafts of alternative versions of existing guidelines. To be honest - I would not have added it to the guidelines to begin with, and kept it on a wiki with not-yet-ready / staging material. Anyway - I would like to shape it up to better fit the general description of content in the Discussion appendix, being more tight and less meandering and fragmented.
Changes:
Corrected what I am certain is a mistype regarding reference methods: It is the default constructor that will certainly do the right thing.