-
Notifications
You must be signed in to change notification settings - Fork 141
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 setTwist/twist take/return a const reference. #4719
Conversation
Signed-off-by: Steven Hahn <[email protected]>
@@ -102,7 +102,8 @@ std::unique_ptr<TrialWaveFunction> WaveFunctionFactory::buildTWF(xmlNodePtr cur, | |||
if (!foundtwist) | |||
{ | |||
//default twist is [0 0 0] | |||
std::vector<ParticleSet::RealType> tsts(3, 0); | |||
tsts.resize(3); |
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.
tsts is size 3 in the declaration (and set to 0) in the declaration. Is there a need to set it again here?
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.
The original code where the declaration of 'tsts' occurs right before the use seems clear to me, but maybe I'm missing something?
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.
Except for the name. In isolation, I would read 'tsts' as 'tests'. Maybe it could be expanded to 'twists'?
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.
I updated the name and added a rvalue function overload to avoid the extra copy.
Signed-off-by: Steven Hahn <[email protected]>
Test this please |
Please review the developer documentation
on the wiki of this project that contains help and requirements.
Proposed changes
Describe what this PR changes and why. If it closes an issue, link to it here
with a supported keyword.
Cleaning up a getter and setter that generate unnecessary copies. Functions were found during work on #4684.
What type(s) of changes does this code introduce?
Delete the items that do not apply
Does this introduce a breaking change?
What systems has this change been tested on?
Checklist
Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.