Sketcher: apply std::ranges

This commit is contained in:
bofdahof
2025-03-12 20:03:13 +10:00
committed by Chris Hennes
parent 2ddd24bc6d
commit fb71aa3292
11 changed files with 210 additions and 309 deletions

View File

@@ -332,14 +332,12 @@ Sketcher::GeoElementId GeoListModel<T>::getGeoElementIdFromVertexId(int vertexId
template<typename T>
int GeoListModel<T>::getVertexIdFromGeoElementId(const Sketcher::GeoElementId& geoelementId) const
{
if (!indexInit) { // lazy initialised
rebuildVertexIndex();
if (!indexInit) {
rebuildVertexIndex(); // lazy initialised
}
auto found =
std::find(VertexId2GeoElementId.begin(), VertexId2GeoElementId.end(), geoelementId);
if (found != VertexId2GeoElementId.end()) {
if (const auto found = std::ranges::find(VertexId2GeoElementId, geoelementId);
found != VertexId2GeoElementId.end()) {
return std::distance(found, VertexId2GeoElementId.begin());
}