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

Remove the unnecessary r-value reference #271

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

tmadlener
Copy link
Contributor

@tmadlener tmadlener commented Dec 19, 2024

The frame is move only in any case

BEGINRELEASENOTES

  • Remove an unnecessary r-value reference qualifier for sinking the metadata Frame into the MetadataSvc.

ENDRELEASENOTES

Mainly because I saw this lightning talk yesterday and this seems to be a case where it's unnecessary.

(We have this in quite a few places, where the move-only property of our types already ensures that a std::move on the calling site is necessary if not using a temporary)

The frame is move only in any case
@m-fila
Copy link
Contributor

m-fila commented Dec 19, 2024

Is the title wrong? The changes here are to rvalue references not to the universal references

@tmadlener tmadlener changed the title Remove the unnecessary universal reference Remove the unnecessary r-value reference Dec 19, 2024
@tmadlener
Copy link
Contributor Author

Yes, indeed. Title should be r-value not universal reference

Copy link
Contributor

@m-fila m-fila left a comment

Choose a reason for hiding this comment

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

Sounds very reasonable, points taken 😄
I couldn't find a clang-tidy check to flag such pattern

Core guidelines rules F.16 and F.18

@jmcarcell
Copy link
Member

Sounds very reasonable, points taken 😄 I couldn't find a clang-tidy check to flag such pattern

Core guidelines rules F.16 and F.18

I think it's only F.18 that applies here, and the key part is for why making this change is just simplicity:

Passing by value does generate one extra (cheap) move operation, but prefer simplicity and clarity first.

@jmcarcell jmcarcell merged commit 6340086 into main Dec 20, 2024
7 of 9 checks passed
@jmcarcell jmcarcell deleted the rm-unnecessary-universalref branch December 20, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants