this post was submitted on 16 Aug 2023
16 points (100.0% liked)
C++
1773 readers
1 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I don't think this trick is anything other than trivia. The happy path to enable RVO is to provide a move constructor. There is nothing unintuitive about that.
This trivia item just points out that the way the C++ standard is specified, the definition isn't actually required. That's hardly relevant.
There is nothing peculiar about handling missing definitions. Linkers only flag those if a symbol is actually missing.
I don't think that your observation makes sense, or is even appropriate to the topic. RVO requires a movable type, and the rule of 5 is a well established aspect of C++. RVO does not change anything in that regard.