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

use move when parameters are passed by value and only copied once #26

Merged
merged 3 commits into from
Apr 15, 2020

Conversation

Hailios
Copy link
Contributor

@Hailios Hailios commented Jun 13, 2019

No description provided.

@scheibel
Copy link
Member

Thanks for this PR. I like adding move semantics where applicable.
I see you only add them when passing them to the next function. Wouldn't we have to change signatures to accept rvalue references as well?

@Hailios
Copy link
Contributor Author

Hailios commented Jun 16, 2019

Thanks for this PR. I like adding move semantics where applicable.
I see you only add them when passing them to the next function. Wouldn't we have to change signatures to accept rvalue references as well?

My intent was to utilize move semantics without changing any signatures. Meaning, I just added it where I felt that it was safe for sure.
More use of move semantics can probably be implemented, but would of course require more work as well.

To answer your question, it is not neccessary to add rvalue signatures for the cases I changed.
What I did was to avoid one copy, and changing the signature to take rvalues could avoid one more copy (the copy to the by-value parameter).

@scheibel scheibel merged commit f9481ee into cginternals:master Apr 15, 2020
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.

2 participants