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

add rvalue reference #5685

Merged
merged 17 commits into from
Dec 22, 2021
Merged

add rvalue reference #5685

merged 17 commits into from
Dec 22, 2021

Conversation

timosachsenberg
Copy link
Contributor

@timosachsenberg timosachsenberg commented Nov 25, 2021

Description

Based on results from clang-tidy scan .

Checklist:

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes. (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI:

If your PR is failing you can check out

Note:

  • Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

@timosachsenberg timosachsenberg changed the title add rvalue reference setter to PId add rvalue reference Nov 25, 2021
@hroest
Copy link
Contributor

hroest commented Nov 25, 2021

also this

hits_.push_back(std::forward<PeptideHit>(hit));

should probably be

hits_.push_back(std::move(hit));

It works, but is somewhat unconvential in an non-templated environment: https://stackoverflow.com/questions/28828159/usage-of-stdforward-vs-stdmove. Alternatively we could capture both cases using a template

template <typename T> void PeptideIdentification::setHits(T&& hits)
{
  hits_ = std::forward<T>(hits);
}

but doesnt seem very much "OpenMS-like"

@timosachsenberg
Copy link
Contributor Author

/rebase

@timosachsenberg
Copy link
Contributor Author

tests pass now.

@@ -197,6 +198,8 @@ namespace OpenMS
result.addSpectrum(std::move(in[k]));
}
}
result.ExperimentalSettings::operator=(in);
Copy link
Contributor

Choose a reason for hiding this comment

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

could also be std::move(in)?
Not crucial though

Copy link
Contributor

@cbielow cbielow left a comment

Choose a reason for hiding this comment

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

nice!

@jpfeuffer jpfeuffer marked this pull request as ready for review December 22, 2021 13:22
@timosachsenberg timosachsenberg merged commit d7218c7 into develop Dec 22, 2021
@timosachsenberg timosachsenberg deleted the add_rvalue_setter branch December 22, 2021 15:39
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.

None yet

4 participants