mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-16 17:31:51 +03:00
Merge pull request #277 from isildur-g/wip-cppcheck271
phase 1 of addressing cppcheck useStlAlgorithm warnings for fill and copy operations
This commit is contained in:
@@ -455,11 +455,10 @@ void cleanupPositions(vector<PositionInfo> &a) {
|
||||
vector<PositionInfo> out;
|
||||
out.reserve(a.size()); // output should be close to input in size.
|
||||
|
||||
for (const auto &p : a) {
|
||||
if (seen.emplace(p.pos, p.flags).second) {
|
||||
out.emplace_back(p); // first encounter
|
||||
}
|
||||
}
|
||||
auto seens = [&seen=seen](const PositionInfo &p) {
|
||||
return (seen.emplace(p.pos, p.flags).second);
|
||||
};
|
||||
std::copy_if(begin(a), end(a), std::back_inserter(out), seens);
|
||||
|
||||
DEBUG_PRINTF("in %zu; out %zu\n", a.size(), out.size());
|
||||
a.swap(out);
|
||||
|
||||
Reference in New Issue
Block a user