diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index eb95bdfab4..70d9a72bd4 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -426,7 +426,7 @@ const std::map SketchObject::getInternalElementMap() co if (!internalElementMap.empty() || !MakeInternals.getValue()) return internalElementMap; - auto internalShape = InternalShape.getShape(); + const auto& internalShape = InternalShape.getShape(); auto shape = Shape.getShape().located(TopLoc_Location()); if (!internalShape.isNull() && !shape.isNull()) { std::vector names; @@ -1142,7 +1142,7 @@ void SketchObject::reverseAngleConstraintToSupplementary(Constraint* constr, int // Edit the expression if any, else modify constraint value directly if (constraintHasExpression(constNum)) { std::string expression = getConstraintExpression(constNum); - setConstraintExpression(constNum, reverseAngleConstraintExpression(expression)); + setConstraintExpression(constNum, std::move(reverseAngleConstraintExpression(expression))); } else { double actAngle = constr->getValue(); @@ -1185,7 +1185,7 @@ void SketchObject::setConstraintExpression(int constNum, const std::string& newE if (info.expression) { try { std::shared_ptr expr(App::Expression::parse(this, newExpression)); - setExpression(path, expr); + setExpression(path, std::move(expr)); } catch (const Base::Exception&) { Base::Console().Error("Failed to set constraint expression."); @@ -1353,7 +1353,7 @@ int SketchObject::diagnoseAdditionalConstraints( return lastDoF; } -int SketchObject::moveGeometries(std::vector geoEltIds, const Base::Vector3d& toPoint, bool relative, +int SketchObject::moveGeometries(const std::vector& geoEltIds, const Base::Vector3d& toPoint, bool relative, bool updateGeoBeforeMoving) { @@ -1935,7 +1935,7 @@ int SketchObject::delGeometriesExclusiveList(const std::vector& GeoIds) void SketchObject::replaceGeometries(std::vector oldGeoIds, std::vector& newGeos) { - auto vals = getInternalGeometry(); + auto& vals = getInternalGeometry(); auto newVals(vals); if (std::any_of(oldGeoIds.begin(), oldGeoIds.end(), [](auto geoId) { @@ -2493,7 +2493,7 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge } } } - delConstraints(deleteme, false); + delConstraints(std::move(deleteme), false); return; } @@ -3449,7 +3449,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(std::move(newConstr)); }; - delConstraints(idsOfOldConstraints, false); + delConstraints(std::move(idsOfOldConstraints), false); if (!isOriginalCurvePeriodic) { transferConstraints(GeoId, PointPos::start, newIds.front(), PointPos::start, true); @@ -3808,7 +3808,7 @@ int SketchObject::split(int GeoId, const Base::Vector3d& point) solve(); } - delConstraints(idsOfOldConstraints); + delConstraints(std::move(idsOfOldConstraints)); addConstraints(newConstraints); for (auto& cons : newConstraints) { @@ -7083,7 +7083,7 @@ int SketchObject::carbonCopy(App::DocumentObject* pObj, bool construction) * * if (expr_info.expression)*/ // App::Expression * expr = parse(this, const std::string& buffer); - setExpression(Constraints.createPath(nextcid), expr); + setExpression(Constraints.createPath(nextcid), std::move(expr)); } } } @@ -9262,7 +9262,7 @@ const std::vector> SketchObject::getCoincidenc std::map tmp; tmp.insert(std::pair(constr->First, constr->FirstPos)); tmp.insert(std::pair(constr->Second, constr->SecondPos)); - coincidenttree.push_back(tmp); + coincidenttree.push_back(std::move(tmp)); } else if (firstpresentin != -1) { // add to existing group @@ -11072,7 +11072,7 @@ std::vector SketchObject::getElementTypes(bool all) const void SketchObject::setExpression(const App::ObjectIdentifier& path, std::shared_ptr expr) { - DocumentObject::setExpression(path, expr); + DocumentObject::setExpression(path, std::move(expr)); if (noRecomputes) { // if we do not have a recompute, the sketch must be solved to update the DoF of the solver, @@ -11589,7 +11589,7 @@ int SketchObject::renameConstraint(int GeoId, std::string name) Base::StateLocker lock(managedoperation, true); Constraint* copy = item->clone(); - copy->Name = name; + copy->Name = std::move(name); Constraints.set1Value(GeoId, copy); delete copy; diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 4d17218403..2b486aaed1 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -354,7 +354,7 @@ public: /// toggle the driving status of this constraint int toggleVirtualSpace(int ConstrId); /// move this point to a new location and solve - int moveGeometries(std::vector geoEltIds, + int moveGeometries(const std::vector& geoEltIds, const Base::Vector3d& toPoint, bool relative = false, bool updateGeoBeforeMoving = false);