-
Notifications
You must be signed in to change notification settings - Fork 19
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
Replace Lists with Vectors #970
Conversation
12b6612
to
95abce8
Compare
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.
Looks good. Some comments over a few of the loops which should be investigated.
src/classes/data1dstore.cpp
Outdated
return std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }) != | ||
data_.end()->get(); |
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.
This doesn't look right and wouldn't traverse the vector:
return std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }) != | |
data_.end()->get(); | |
return std::find_if(data_.begin(), data_.end(), [&name](auto &data) { return data->first.tag() == name; }) != | |
data_.end(); |
src/classes/data1dstore.cpp
Outdated
auto it = std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }); | ||
if (it == data_.end()->get()) |
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.
Same here:
auto it = std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }); | |
if (it == data_.end()->get()) | |
auto it = std::find_if(data_.begin(), data_.end(), [&name](auto &data) { return data->first.tag() == name; }); | |
if (it == data_.end()) |
src/classes/data2dstore.cpp
Outdated
return std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }) != | ||
data_.end()->get(); |
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.
return std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }) != | |
data_.end()->get(); | |
auto it = std::find_if(data_.begin(), data_.end(), [&name](auto &data) { return data->first.tag() == name; }); | |
if (it == data_.end()) |
src/classes/data2dstore.cpp
Outdated
auto it = std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }); | ||
if (it == data_.end()->get()) |
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.
auto it = std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }); | |
if (it == data_.end()->get()) | |
auto it = std::find_if(data_.begin(), data_.end(), [&name](auto &data) { return data->first.tag() == name; }); | |
if (it == data_.end()) |
src/classes/data3dstore.cpp
Outdated
return std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }) != | ||
data_.end()->get(); |
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.
return std::find_if(data_.begin()->get(), data_.end()->get(), [&name](auto &data) { return data.first.tag() == name; }) != | |
data_.end()->get(); | |
auto it = std::find_if(data_.begin(), data_.end(), [&name](auto &data) { return data->first.tag() == name; }); | |
if (it == data_.end()) |
src/keywords/data3dstore.cpp
Outdated
@@ -40,8 +40,9 @@ bool Data3DStoreKeyword::deserialise(LineParser &parser, int startArg, const Cor | |||
// Serialise data to specified LineParser | |||
bool Data3DStoreKeyword::serialise(LineParser &parser, std::string_view keywordName, std::string_view prefix) const | |||
{ | |||
for (const auto &[data, format] : data_.data()) | |||
for (const auto sharedDataPointer : data_.data()) |
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.
for (const auto sharedDataPointer : data_.data()) | |
for (const auto &sharedDataPointer : data_.data()) |
@@ -22,8 +22,9 @@ bool DataTestModule::process(Dissolve &dissolve, ProcessPool &procPool) | |||
Messenger::print("\n"); | |||
|
|||
// Loop over reference one-dimensional data supplied | |||
for (auto &[referenceData, format] : test1DData_.data()) | |||
for (auto sharedDataPointer : test1DData_.data()) |
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.
for (auto sharedDataPointer : test1DData_.data()) | |
for (auto &sharedDataPointer : test1DData_.data()) |
src/modules/datatest/process.cpp
Outdated
@@ -63,8 +64,9 @@ bool DataTestModule::process(Dissolve &dissolve, ProcessPool &procPool) | |||
} | |||
|
|||
// Loop over reference two-dimensional data supplied | |||
for (auto &[referenceData, format] : test2DData_.data()) | |||
for (auto sharedDataPointer : test2DData_.data()) |
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.
for (auto sharedDataPointer : test2DData_.data()) | |
for (auto &sharedDataPointer : test2DData_.data()) |
src/modules/rdf/functions.cpp
Outdated
@@ -645,8 +645,9 @@ bool RDFModule::testReferencePartials(const Data1DStore &testData, double testTh | |||
LineParser parser; | |||
|
|||
// Loop over supplied test data and see if we can locate it amongst our PartialSets | |||
for (auto &[data, format] : testData.data()) | |||
for (auto sharedDataPointer : testData.data()) |
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.
for (auto sharedDataPointer : testData.data()) | |
for (auto &sharedDataPointer : testData.data()) |
src/modules/rdf/functions.cpp
Outdated
@@ -675,8 +676,9 @@ bool RDFModule::testReferencePartials(const Data1DStore &testData, double testTh | |||
LineParser parser; | |||
|
|||
// Loop over supplied test data and see if we can locate it amongst our PartialSets | |||
for (auto &[data, format] : testData.data()) | |||
for (auto sharedDataPointer : testData.data()) |
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.
for (auto sharedDataPointer : testData.data()) | |
for (auto &sharedDataPointer : testData.data()) |
I agree with Tristan's comments, but otherwise approve. |
Closes #619
Pretty much what's being said in the title. Replacing
std::lists
withstd::vectors
where possible.Changed the following areas:
data1dstore.h
data2dstore.h
data3dstore.h
combopopulator.h
tablewidgetupdater.h
treewidgetupdater.h