Repository navigation
Code Arrangement Changes #6 - #5457
Merged
Merged
Conversation
| // names_ has the union of all Element*, deleting this is sufficient to avoid mem leaks | ||
| map<string, const Element*>::iterator it = names_.begin(); | ||
| for (; it != names_.end(); ++it) | ||
| for (map<string, const Element*>::iterator it = names_.begin(); it != names_.end(); ++it) |
Contributor
There was a problem hiding this comment.
could probably be rewritten with structure binding
| { | ||
| const_iterator cit = elements_.begin(); | ||
| for (; cit != elements_.end(); ++cit) | ||
| for (const_iterator cit = elements_.begin(); cit != elements_.end(); ++cit) |
Contributor
There was a problem hiding this comment.
coudl be rewritten with range for loop
| bool found = false; | ||
| iterator it = elements_.begin(); | ||
| for (; it != elements_.end(); ++it) | ||
| for (iterator it = elements_.begin(); it != elements_.end(); ++it) |
| const_iterator cit = elements_.begin(); | ||
| for (; cit != elements_.end(); ++cit) | ||
|
|
||
| for (const_iterator cit = elements_.begin(); cit != elements_.end(); ++cit) |
| */ | ||
|
|
||
| IMSIsotopeDistribution & IMSIsotopeDistribution::operator=(const IMSIsotopeDistribution & distribution) | ||
| IMSIsotopeDistribution & IMSIsotopeDistribution::operator=(const IMSIsotopeDistribution & distribution) |
Contributor
There was a problem hiding this comment.
did you check if it can be defaulted? (= default) I dind't but could be a candidate
| map<unsigned int, double> bor_abundance = {{10u, 0.19899999999999998}, {11u, 0.8009999999999999}}; | ||
| map<unsigned int, double> bor_mass = {{10u, 10.012937000000001}, {11u, 11.009304999999999}}; | ||
| buildElement_("Boron", "B", 5u, bor_abundance, bor_mass); | ||
| buildElement_("Bor", "B", 5u, bor_abundance, bor_mass); |
Contributor
There was a problem hiding this comment.
probably need to integrate the other change you made here
Contributor
Author
|
Ready for review @timosachsenberg |
| // names_ has the union of all Element*, deleting this is sufficient to avoid mem leaks | ||
| map<string, const Element*>::iterator it = names_.begin(); | ||
| for (; it != names_.end(); ++it) | ||
| for (auto &[string,Element] : names_) |
Contributor
There was a problem hiding this comment.
better not to use a class name as variable name
for (auto &[s, element] : names_)
But I just realized that this might lead to an unused variable warning.
Maybe better to just use
for (auto it = names_.begin(); it != names_.end(); ++it)
Contributor
|
Nice. Thanks! |
timosachsenberg
added a commit
that referenced
this pull request
Jul 28, 2021
* Code Arrangement Changes #6 (#5457) * Code Arrangement Changes #6 * Update IMSAlphabet.cpp * Update ElementDB.cpp * Update ElementDB.cpp * Update ElementDB.cpp * Update ElementDB.cpp Co-authored-by: Arraxx <[email protected]> * fix operator< test Co-authored-by: Aman Kumar <[email protected]> Co-authored-by: Arraxx <[email protected]> Co-authored-by: timosachsenberg <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Code changes for better readability.
Checklist:
How can I get additional information on failed tests during CI:
If your PR is failing you can check out
Note: