This idiom is used in many other places. This patch changes a number of locations
where we do the same thing but instead use a different idiom, using a temporary
iterator and/or using resize() instead of erase().
// keep only the unique elements
std::sort(indices.begin(), indices.end());
- std::vector<types::global_dof_index>::iterator it;
- it = std::unique(indices.begin(), indices.end());
- indices.resize(it - indices.begin());
+ indices.erase(std::unique(indices.begin(), indices.end()), indices.end());
}
get_unique_component_names(const std::vector<std::string> &component_names)
{
auto elements = component_names;
- auto last = std::unique(elements.begin(), elements.end());
- elements.resize(last - elements.begin());
+ elements.erase(std::unique(elements.begin(), elements.end()),
+ elements.end());
return elements;
}
std::sort(next_round_dofs.begin(), next_round_dofs.end());
// delete multiple entries
- std::vector<DynamicSparsityPattern::size_type>::iterator end_sorted;
- end_sorted =
- std::unique(next_round_dofs.begin(), next_round_dofs.end());
- next_round_dofs.erase(end_sorted, next_round_dofs.end());
+ next_round_dofs.erase(std::unique(next_round_dofs.begin(),
+ next_round_dofs.end()),
+ next_round_dofs.end());
// eliminate dofs which are already numbered
for (int s = next_round_dofs.size() - 1; s >= 0; --s)
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams