Fix -Wredundant-move warnings, 2nd try
std::move is redundant when it is used to return a local object from a function (eg return std::move(local)): indeed, returning a local object from a function implicitly moves it. Moreover using std::move this way See https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rf-return-move-local However, in order to avoid -Wreturn-std-move as well, a Base object is move-constructed from Derived when required.
This commit is contained in:
@@ -2222,7 +2222,7 @@ TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
|
||||
TopoDS_Edge edgeOnSurf = BRepBuilderAPI_MakeEdge(segm , surf);
|
||||
TopoDS_Wire wire = BRepBuilderAPI_MakeWire(edgeOnSurf);
|
||||
BRepLib::BuildCurves3d(wire);
|
||||
return std::move(wire);
|
||||
return TopoDS_Shape(std::move(wire));
|
||||
}
|
||||
|
||||
//***********
|
||||
@@ -2308,7 +2308,7 @@ TopoDS_Shape TopoShape::makeLongHelix(Standard_Real pitch, Standard_Real height,
|
||||
|
||||
TopoDS_Wire wire = mkWire.Wire();
|
||||
BRepLib::BuildCurves3d(wire);
|
||||
return std::move(wire);
|
||||
return TopoDS_Shape(std::move(wire));
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeThread(Standard_Real pitch,
|
||||
@@ -2926,9 +2926,10 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b
|
||||
TopoDS_Compound result;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound(result);
|
||||
for(TopoDS_Shape &sh : shapesToReturn)
|
||||
for(TopoDS_Shape &sh : shapesToReturn) {
|
||||
builder.Add(result, sh);
|
||||
return std::move(result);
|
||||
}
|
||||
return TopoDS_Shape(std::move(result));
|
||||
}
|
||||
else {
|
||||
return shapesToReturn[0];
|
||||
@@ -3175,7 +3176,7 @@ TopoDS_Shape TopoShape::removeSplitter() const
|
||||
builder.Add(comp, xp.Current());
|
||||
}
|
||||
|
||||
return std::move(comp);
|
||||
return TopoDS_Shape(std::move(comp));
|
||||
}
|
||||
|
||||
return _Shape;
|
||||
|
||||
Reference in New Issue
Block a user