diff --git a/src/App/ColorModel.cpp b/src/App/ColorModel.cpp index 1d81b6e8c3..0dec15bb13 100644 --- a/src/App/ColorModel.cpp +++ b/src/App/ColorModel.cpp @@ -334,8 +334,8 @@ ColorLegend::ColorLegend (void) : _bOutsideGrayed(false) { // default green, red - _aclColorFields.push_back(Color(0, 1, 0)); - _aclColorFields.push_back(Color(1, 0, 0)); + _aclColorFields.emplace_back(0, 1, 0); + _aclColorFields.emplace_back(1, 0, 0); _aclNames.push_back("Min"); _aclNames.push_back("Max"); diff --git a/src/App/Property.cpp b/src/App/Property.cpp index af153fa4a6..1fe6af65ce 100644 --- a/src/App/Property.cpp +++ b/src/App/Property.cpp @@ -130,7 +130,7 @@ const boost::any Property::getPathValue(const ObjectIdentifier &path) const void Property::getPaths(std::vector &paths) const { - paths.push_back(App::ObjectIdentifier(getContainer(), getName())); + paths.emplace_back(getContainer(), getName()); } ObjectIdentifier Property::canonicalPath(const ObjectIdentifier &p) const diff --git a/src/App/PropertyExpressionEngine.cpp b/src/App/PropertyExpressionEngine.cpp index 31cacdf17a..3d3800a845 100644 --- a/src/App/PropertyExpressionEngine.cpp +++ b/src/App/PropertyExpressionEngine.cpp @@ -245,7 +245,7 @@ void PropertyExpressionEngine::buildGraphStructures(const ObjectIdentifier & pat int s = nodes.size(); nodes[cPath] = s; } - edges.push_back(std::make_pair(nodes[path], nodes[cPath])); + edges.emplace_back(nodes[path], nodes[cPath]); } } } diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 1eafe40f6c..8bb91fbdeb 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -1781,7 +1781,7 @@ void PropertyLinkSubList::setValue(DocumentObject* lValue, const std::vector_lValueList.push_back(lValue); - this->_lSubList.push_back(std::string()); + this->_lSubList.emplace_back(); } } else { @@ -1893,7 +1893,7 @@ std::vector PropertyLinkSubList::getSubListValues(b sub = _lSubList[i]; if (values.size() == 0 || values.back().first != link){ //new object started, start a new subset. - values.push_back(SubSet(link, std::vector())); + values.emplace_back(link, std::vector()); } values.back().second.push_back(sub); } diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 2c41117a2a..d4d510a9fa 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -589,7 +589,7 @@ std::vector FileInfo::getDirectoryContent(void) const { std::string dir = dentry->d_name; if (dir != "." && dir != "..") - List.push_back(FileInfo(FileName + "/" + dir)); + List.emplace_back(FileName + "/" + dir); } closedir(dp); #else diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index 046e516d15..63127ce928 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -485,9 +485,9 @@ std::vector > ParameterGrp::GetBoolMap(const char * // check on filter condition if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { if (strcmp(StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),"1")) - vrValues.push_back(std::make_pair(Name, false)); + vrValues.emplace_back(Name, false); else - vrValues.push_back(std::make_pair(Name, true)); + vrValues.emplace_back(Name, true); } pcTemp = FindNextElement(pcTemp,"FCBool"); } @@ -549,8 +549,8 @@ std::vector > ParameterGrp::GetIntMap(const char * s Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { - vrValues.push_back(std::make_pair(Name, - ( atol (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str())))); + vrValues.emplace_back(Name, + ( atol (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()))); } pcTemp = FindNextElement(pcTemp,"FCInt") ; } @@ -612,8 +612,8 @@ std::vector > ParameterGrp::GetUnsignedMap( Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { - vrValues.push_back(std::make_pair(Name, - ( strtoul (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),0,10) ))); + vrValues.emplace_back(Name, + ( strtoul (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),0,10) )); } pcTemp = FindNextElement(pcTemp,"FCUInt"); } @@ -675,8 +675,8 @@ std::vector > ParameterGrp::GetFloatMap(const char Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { - vrValues.push_back(std::make_pair(Name, - ( atof (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str())))); + vrValues.emplace_back(Name, + ( atof (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()))); } pcTemp = FindNextElement(pcTemp,"FCFloat"); } @@ -754,7 +754,7 @@ std::vector ParameterGrp::GetASCIIs(const char * sFilter) const // retrieve the text element DOMNode *pcElem2 = pcTemp->getFirstChild(); if (pcElem2) - vrValues.push_back( std::string(StrXUTF8(pcElem2->getNodeValue()).c_str()) ); + vrValues.emplace_back(StrXUTF8(pcElem2->getNodeValue()).c_str() ); } pcTemp = FindNextElement(pcTemp,"FCText"); } @@ -776,7 +776,7 @@ std::vector > ParameterGrp::GetASCIIMap(const // retrieve the text element DOMNode *pcElem2 = pcTemp->getFirstChild(); if (pcElem2) - vrValues.push_back(std::make_pair(Name, std::string(StrXUTF8(pcElem2->getNodeValue()).c_str()))); + vrValues.emplace_back(Name, std::string(StrXUTF8(pcElem2->getNodeValue()).c_str())); } pcTemp = FindNextElement(pcTemp,"FCText"); } diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 8f96ade4dd..b7d5687d94 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -969,7 +969,7 @@ std::vector > Document::getViewProvid if (node->isOfType(SoSeparator::getClassTypeId())) { auto it = d->_CoinMap.find(static_cast(node)); if(it!=d->_CoinMap.end()) - ret.push_back(std::make_pair(it->second,i)); + ret.emplace_back(it->second,i); } } return ret; diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 2b156189ca..19d450c9f3 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -583,13 +583,13 @@ void NaviCubeImplementation::addFace(const Vector3f& x, const Vector3f& z, int f int t = m_VertexArray.size(); m_VertexArray.push_back(z - x - y); - m_TextureCoordArray.push_back(Vector2f(0, 0)); + m_TextureCoordArray.emplace_back(0, 0); m_VertexArray.push_back(z + x - y); - m_TextureCoordArray.push_back(Vector2f(1, 0)); + m_TextureCoordArray.emplace_back(1, 0); m_VertexArray.push_back(z + x + y); - m_TextureCoordArray.push_back(Vector2f(1, 1)); + m_TextureCoordArray.emplace_back(1, 1); m_VertexArray.push_back(z - x + y); - m_TextureCoordArray.push_back(Vector2f(0, 1)); + m_TextureCoordArray.emplace_back(0, 1); // TEX_TOP, TEX_BACK_FACE, TEX_FRONT_FACE, TEX_TOP // TEX_TOP frontTex, diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index 44ba700561..6b7bf3e1c5 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -530,7 +530,7 @@ std::vector SelectionSingleton::getObjectList(const char* pDocN if(resolve && !temp[it->second]._SubNameSet.insert(subelement).second) continue; temp[it->second].SubNames.push_back(subelement); - temp[it->second].SelPoses.push_back(Base::Vector3d(sel.x,sel.y,sel.z)); + temp[it->second].SelPoses.emplace_back(sel.x,sel.y,sel.z); } } else { @@ -542,7 +542,7 @@ std::vector SelectionSingleton::getObjectList(const char* pDocN temp.emplace_back(obj); if (subelement && *subelement) { temp.back().SubNames.push_back(subelement); - temp.back().SelPoses.push_back(Base::Vector3d(sel.x,sel.y,sel.z)); + temp.back().SelPoses.emplace_back(sel.x,sel.y,sel.z); if(resolve) temp.back()._SubNameSet.insert(subelement); } @@ -617,7 +617,7 @@ int SelectionSingleton::getAsPropertyLinkSubList(App::PropertyLinkSubList &prop) const std::vector &subnames = selitem.getSubNames(); if (subnames.size() == 0){//whole object is selected objs.push_back(obj); - subs.push_back(std::string()); + subs.emplace_back(); } else { for (std::size_t isub = 0; isub < subnames.size(); isub++) { objs.push_back(obj); @@ -995,7 +995,7 @@ bool SelectionSingleton::addSelection(const char* pDocName, const char* pObjectN if(pickedList) { _PickedList.clear(); for(const auto &sel : *pickedList) { - _PickedList.push_back(_SelObj()); + _PickedList.emplace_back(); auto &s = _PickedList.back(); s.DocName = sel.DocName; s.FeatName = sel.FeatName; @@ -1276,7 +1276,7 @@ void SelectionSingleton::rmvSelection(const char* pDocName, const char* pObjectN if(pickedList) { _PickedList.clear(); for(const auto &sel : *pickedList) { - _PickedList.push_back(_SelObj()); + _PickedList.emplace_back(); auto &s = _PickedList.back(); s.DocName = sel.DocName; s.FeatName = sel.FeatName; @@ -2172,7 +2172,7 @@ PyObject *SelectionSingleton::sGetSelectionObject(PyObject * /*self*/, PyObject double x = (double)Py::Float(t.getItem(0)); double y = (double)Py::Float(t.getItem(1)); double z = (double)Py::Float(t.getItem(2)); - selObj.SelPoses.push_back(Base::Vector3d(x,y,z)); + selObj.SelPoses.emplace_back(x,y,z); } } diff --git a/src/Gui/SelectionObject.cpp b/src/Gui/SelectionObject.cpp index 5c36395dea..6b3e003365 100644 --- a/src/Gui/SelectionObject.cpp +++ b/src/Gui/SelectionObject.cpp @@ -52,7 +52,7 @@ SelectionObject::SelectionObject(const Gui::SelectionChanges& msg) TypeName = msg.pTypeName ? msg.pTypeName : ""; if (msg.pSubName) { SubNames.push_back(msg.pSubName); - SelPoses.push_back(Base::Vector3d(msg.x, msg.y, msg.z)); + SelPoses.emplace_back(msg.x, msg.y, msg.z); } } diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 2c363b6afc..6e3d8baadb 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -612,7 +612,7 @@ std::vector ViewProvider::getModelPoints(const SoPickedPoint* pp // the default implementation just returns the picked point from the visual representation std::vector pts; const SbVec3f& vec = pp->getPoint(); - pts.push_back(Base::Vector3d(vec[0],vec[1],vec[2])); + pts.emplace_back(vec[0],vec[1],vec[2]); return pts; } diff --git a/src/Mod/Fem/App/FemConstraint.cpp b/src/Mod/Fem/App/FemConstraint.cpp index a69b9a2f89..20d9745dce 100644 --- a/src/Mod/Fem/App/FemConstraint.cpp +++ b/src/Mod/Fem/App/FemConstraint.cpp @@ -178,7 +178,7 @@ bool Constraint::getPoints(std::vector &points, std::vector &points, std::vector &points, std::vector > FemMesh::getVolumesByFace(const TopoDS_Face &fac // For curved faces it is possible that a volume contributes more than one face if (element_face_nodes.size() == static_cast(numNodes)) { - result.push_back(std::make_pair(vol->GetID(), face->GetID())); + result.emplace_back(vol->GetID(), face->GetID()); } } } diff --git a/src/Mod/Mesh/App/AppMeshPy.cpp b/src/Mod/Mesh/App/AppMeshPy.cpp index 1570867aeb..4e5851c364 100644 --- a/src/Mod/Mesh/App/AppMeshPy.cpp +++ b/src/Mod/Mesh/App/AppMeshPy.cpp @@ -460,8 +460,8 @@ private: float hy = y/2.0f; std::vector TriaList; - TriaList.push_back(MeshCore::MeshGeomFacet(Base::Vector3f(-hx, -hy, 0.0),Base::Vector3f(hx, hy, 0.0),Base::Vector3f(-hx, hy, 0.0))); - TriaList.push_back(MeshCore::MeshGeomFacet(Base::Vector3f(-hx, -hy, 0.0),Base::Vector3f(hx, -hy, 0.0),Base::Vector3f(hx, hy, 0.0))); + TriaList.emplace_back(Base::Vector3f(-hx, -hy, 0.0),Base::Vector3f(hx, hy, 0.0),Base::Vector3f(-hx, hy, 0.0)); + TriaList.emplace_back(Base::Vector3f(-hx, -hy, 0.0),Base::Vector3f(hx, -hy, 0.0),Base::Vector3f(hx, hy, 0.0)); std::unique_ptr mesh(new MeshObject); mesh->addFacets(TriaList); diff --git a/src/Mod/Mesh/App/Core/Algorithm.cpp b/src/Mod/Mesh/App/Core/Algorithm.cpp index 3fad515afd..40d7727dbc 100644 --- a/src/Mod/Mesh/App/Core/Algorithm.cpp +++ b/src/Mod/Mesh/App/Core/Algorithm.cpp @@ -498,7 +498,7 @@ void MeshAlgorithm::GetFacetBorders (const std::vector &raulInd, // thus doesn't invalidate the iterator itself, only the referenced object if ((pEI == aclEdges.end()) || aclEdges.empty() || (ulLast == ulFirst)) { // no further edge found or closed polyline, respectively - rclBorders.push_back(std::vector(clBorder.begin(), clBorder.end())); + rclBorders.emplace_back(clBorder.begin(), clBorder.end()); clBorder.clear(); if (aclEdges.size() > 0) { @@ -1455,7 +1455,7 @@ bool MeshAlgorithm::CutWithPlane (const Base::Vector3f &clBase, const Base::Vect // Facet schneiden und Schnittstrecke ablegen if (clF.IntersectWithPlane(clBase, clNormal, clE1, clE2) == true) - clTempPoly.push_back(std::pair(clE1, clE2)); + clTempPoly.emplace_back(clE1, clE2); } if(bConnectPolygons) @@ -1574,7 +1574,7 @@ bool MeshAlgorithm::ConnectLines (std::list(clPoly.begin(), clPoly.end())); + rclPolylines.emplace_back(clPoly.begin(), clPoly.end()); } // remove all polylines with too few length diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index 0c2c7b50c0..c91f0c6c9e 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -373,7 +373,7 @@ bool MeshEvalTopology::Evaluate () else { if (count > 2) { // Edge that is shared by more than 2 facets - nonManifoldList.push_back(std::make_pair(p0, p1)); + nonManifoldList.emplace_back(p0, p1); nonManifoldFacets.push_back(facets); } @@ -681,7 +681,7 @@ void MeshEvalSelfIntersection::GetIntersections(const std::vectorIntersectWithFacet(*cMF2, pt1, pt2); if (ret == 2) { - intersection.push_back(std::make_pair(pt1, pt2)); + intersection.emplace_back(pt1, pt2); } } } @@ -749,7 +749,7 @@ void MeshEvalSelfIntersection::GetIntersections(std::vector(g)/255.0f; float fb = static_cast(b)/255.0f; float fa = static_cast(a)/255.0f; - _material->diffuseColor.push_back(App::Color(fr, fg, fb, fa)); + _material->diffuseColor.emplace_back(fr, fg, fb, fa); } meshPoints.push_back(MeshPoint(Base::Vector3f(fX, fY, fZ))); cntPoints++; @@ -893,7 +893,7 @@ bool MeshInput::LoadPLY (std::istream &inp) } // store the property name and type - vertex_props.push_back(std::make_pair(name, number)); + vertex_props.emplace_back(name, number); } else if (element == "face") { std::string list, uchr; @@ -1064,7 +1064,7 @@ bool MeshInput::LoadPLY (std::istream &inp) float r = (prop_values["red"]) / 255.0f; float g = (prop_values["green"]) / 255.0f; float b = (prop_values["blue"]) / 255.0f; - _material->diffuseColor.push_back(App::Color(r, g, b)); + _material->diffuseColor.emplace_back(r, g, b); } } @@ -1146,7 +1146,7 @@ bool MeshInput::LoadPLY (std::istream &inp) float r = (prop_values["red"]) / 255.0f; float g = (prop_values["green"]) / 255.0f; float b = (prop_values["blue"]) / 255.0f; - _material->diffuseColor.push_back(App::Color(r, g, b)); + _material->diffuseColor.emplace_back(r, g, b); } } diff --git a/src/Mod/Mesh/App/Core/Projection.cpp b/src/Mod/Mesh/App/Core/Projection.cpp index d27a7c942f..b7ff4d7578 100644 --- a/src/Mod/Mesh/App/Core/Projection.cpp +++ b/src/Mod/Mesh/App/Core/Projection.cpp @@ -185,23 +185,23 @@ bool MeshProjection::projectLineOnMesh(const MeshFacetGrid& grid, continue; } - cutLine.push_back(std::pair(e1, e2)); + cutLine.emplace_back(e1, e2); } else { if (*it == f1) { // start facet if (((e2 - v1) * dir) > 0.0f) - cutLine.push_back(std::pair(v1, e2)); + cutLine.emplace_back(v1, e2); else - cutLine.push_back(std::pair(v1, e1)); + cutLine.emplace_back(v1, e1); //start = it - facets.begin(); } if (*it == f2) { // end facet if (((e2 - v2) * -dir) > 0.0f) - cutLine.push_back(std::pair(v2, e2)); + cutLine.emplace_back(v2, e2); else - cutLine.push_back(std::pair(v2, e1)); + cutLine.emplace_back(v2, e1); //end = it - facets.begin(); } diff --git a/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp b/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp index e5fc620158..1f598fabdc 100644 --- a/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp +++ b/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp @@ -425,7 +425,7 @@ void MeshTopoAlgorithm::AdjustEdgesToCurvatureDirection() MeshPointIterator cPIt( _rclMesh ); aPnts.reserve(_rclMesh.CountPoints()); for ( cPIt.Init(); cPIt.More(); cPIt.Next() ) - aPnts.push_back( Wm4::Vector3( cPIt->x, cPIt->y, cPIt->z ) ); + aPnts.emplace_back( cPIt->x, cPIt->y, cPIt->z ); // get all point connections std::vector aIdx; diff --git a/src/Mod/Mesh/App/Core/Triangulation.cpp b/src/Mod/Mesh/App/Core/Triangulation.cpp index ca23d98b11..74e6410da2 100644 --- a/src/Mod/Mesh/App/Core/Triangulation.cpp +++ b/src/Mod/Mesh/App/Core/Triangulation.cpp @@ -648,7 +648,7 @@ bool DelaunayTriangulator::Triangulate() std::vector akVertex; akVertex.reserve(_points.size()); for (std::vector::iterator it = _points.begin(); it != _points.end(); ++it) { - akVertex.push_back(Wm4::Vector2d(static_cast(it->x), static_cast(it->y))); + akVertex.emplace_back(static_cast(it->x), static_cast(it->y)); } Wm4::Delaunay2d del(static_cast(akVertex.size()), &(akVertex[0]), 0.001, false, Wm4::Query::QT_INT64); diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 97ed027dde..67e1ac6fb7 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -458,7 +458,7 @@ void MeshObject::swapKernel(MeshCore::MeshKernel& kernel, if (prop < it->_ulProp) { prop = it->_ulProp; if (!segment.empty()) { - this->_segments.push_back(Segment(this,segment,true)); + this->_segments.emplace_back(this,segment,true); segment.clear(); } } @@ -468,7 +468,7 @@ void MeshObject::swapKernel(MeshCore::MeshKernel& kernel, // if the whole mesh is a single object then don't mark as segment if (!segment.empty() && (segment.size() < faces.size())) { - this->_segments.push_back(Segment(this,segment,true)); + this->_segments.emplace_back(this,segment,true); } // apply the group names to the segments @@ -1213,7 +1213,7 @@ void MeshObject::splitEdges() if (!pF->IsFlag(MeshCore::MeshFacet::VISIT) && !rFace.IsFlag(MeshCore::MeshFacet::VISIT)) { pF->SetFlag(MeshCore::MeshFacet::VISIT); rFace.SetFlag(MeshCore::MeshFacet::VISIT); - adjacentFacet.push_back(std::make_pair(pF-rFacets.begin(), pF->_aulNeighbours[id])); + adjacentFacet.emplace_back(pF-rFacets.begin(), pF->_aulNeighbours[id]); } } } @@ -1368,7 +1368,7 @@ void MeshObject::removeSelfIntersections(const std::vector& indic for (it = indices.begin(); it != indices.end(); ) { unsigned long id1 = *it; ++it; unsigned long id2 = *it; ++it; - selfIntersections.push_back(std::make_pair(id1,id2)); + selfIntersections.emplace_back(id1,id2); } if (!selfIntersections.empty()) { @@ -1747,7 +1747,7 @@ void MeshObject::addSegment(const std::vector& inds) throw Base::IndexError("Index out of range"); } - this->_segments.push_back(Segment(this,inds,true)); + this->_segments.emplace_back(this,inds,true); } const Segment& MeshObject::getSegment(unsigned long index) const @@ -1810,7 +1810,7 @@ std::vector MeshObject::getSegmentsOfType(MeshObject::GeometryType type const std::vector& data = surf->GetSegments(); for (std::vector::const_iterator it = data.begin(); it != data.end(); ++it) { - segm.push_back(Segment(const_cast(this), *it, false)); + segm.emplace_back(const_cast(this), *it, false); } } diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index fc1cabbc7d..540394946e 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -248,7 +248,7 @@ PyObject* MeshPy::write(PyObject *args, PyObject *kwds) float r = (float)Py::Float(t.getItem(0)); float g = (float)Py::Float(t.getItem(1)); float b = (float)Py::Float(t.getItem(2)); - mat.diffuseColor.push_back(App::Color(r,g,b)); + mat.diffuseColor.emplace_back(r,g,b); } if (mat.diffuseColor.size() == getMeshObjectPtr()->countPoints()) @@ -288,7 +288,7 @@ PyObject* MeshPy::write(PyObject *args, PyObject *kwds) float r = (float)Py::Float(t.getItem(0)); float g = (float)Py::Float(t.getItem(1)); float b = (float)Py::Float(t.getItem(2)); - mat->diffuseColor.push_back(App::Color(r,g,b)); + mat->diffuseColor.emplace_back(r,g,b); } if (mat->diffuseColor.size() == getMeshObjectPtr()->countPoints()) @@ -324,7 +324,7 @@ PyObject* MeshPy::writeInventor(PyObject *args) std::vector coords; coords.reserve(mesh->countPoints()); for (MeshObject::const_point_iterator it = mesh->points_begin(); it != mesh->points_end(); ++it) - coords.push_back(Base::Vector3f((float)it->x,(float)it->y,(float)it->z)); + coords.emplace_back((float)it->x,(float)it->y,(float)it->z); indices.reserve(4*faces.size()); for (MeshCore::MeshFacetArray::_TConstIterator it = faces.begin(); it != faces.end(); ++it) { indices.push_back(it->_aulPoints[0]); @@ -710,7 +710,7 @@ PyObject* MeshPy::addFacets(PyObject *args) for (Py::List::iterator it = list_v.begin(); it != list_v.end(); ++it) { if ((*it).isType(vType)) { Base::Vector3d v = static_cast((*it).ptr())->value(); - vertices.push_back(Base::Vector3f((float)v.x,(float)v.y,(float)v.z)); + vertices.emplace_back((float)v.x,(float)v.y,(float)v.z); } } diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp index 35c7d55a3f..7c7a7ebde8 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp @@ -1006,8 +1006,7 @@ void SoFCIndexedFaceSet::stopSelection(SoAction * action) GLint index=0; for (GLint ii=0;ii - (selectBuf[index+1]/4294967295.0,selectBuf[index+3])); + hit.emplace_back(selectBuf[index+1]/4294967295.0,selectBuf[index+3]); index = index+ct+3; } diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp index 6239c7eb47..f53336feea 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp @@ -1046,8 +1046,7 @@ void SoFCMeshObjectShape::stopSelection(SoAction * action, const Mesh::MeshObjec GLuint index=0; for (GLint ii=0;ii - (selectBuf[index+1]/4294967295.0,selectBuf[index+3])); + hit.emplace_back(selectBuf[index+1]/4294967295.0,selectBuf[index+3]); index = index+ct+3; } diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index 5ae2228efd..333672060f 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -709,7 +709,7 @@ void ViewProviderMesh::exportMesh(const char* filename, const char* fmt) const mat.diffuseColor.reserve(numColors); for (int i=0; i(getObject())->Mesh.getValue(); @@ -801,12 +801,12 @@ bool ViewProviderMesh::createToolMesh(const std::vector& rclPoly, const if (it+1 < rclPoly.end()) { pt1.getValue(fX, fY, fZ); - top.push_back( Base::Vector3f(fX, fY, fZ) ); + top.emplace_back(fX, fY, fZ ); pt2.getValue(fX, fY, fZ); - bottom.push_back( Base::Vector3f(fX, fY, fZ) ); + bottom.emplace_back(fX, fY, fZ ); // polygon we need to triangulate (in x,y-plane) it->getValue(fX, fY); - polygon.push_back( Base::Vector3f(fX, fY, 0.0f) ); + polygon.emplace_back(fX, fY, 0.0f ); } } diff --git a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp index 11aaa9b6b8..ece4d59475 100644 --- a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp @@ -646,7 +646,7 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector > lines; diff --git a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp index 4234d7e234..996cdf89d7 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp @@ -141,7 +141,7 @@ void ViewProviderMeshTransformDemolding::calcNormalVector(void) const MeshGeomFacet& rFace = *cFIt; Base::Vector3f norm(rFace.GetNormal()); - normalVector.push_back(SbVec3f(norm.x,norm.y,norm.z)); + normalVector.emplace_back(norm.x,norm.y,norm.z); } } diff --git a/src/Mod/MeshPart/App/CurveProjector.cpp b/src/Mod/MeshPart/App/CurveProjector.cpp index d54aef2809..285d9cdd53 100644 --- a/src/Mod/MeshPart/App/CurveProjector.cpp +++ b/src/Mod/MeshPart/App/CurveProjector.cpp @@ -301,9 +301,9 @@ void CurveProjectorSimple::GetSampledCurves( const TopoDS_Edge& aEdge, std::vect for (unsigned long i = 0; i < ulNbOfPoints; i++) { gp_Pnt gpPt = hCurve->Value(fBegin + (fLen * float(i)) / float(ulNbOfPoints-1)); - rclPoints.push_back(Base::Vector3f((float)gpPt.X(), + rclPoints.emplace_back((float)gpPt.X(), (float)gpPt.Y(), - (float)gpPt.Z())); + (float)gpPt.Z()); } } @@ -670,10 +670,10 @@ void CurveProjectorWithToolMesh::makeToolMesh( const TopoDS_Edge& aEdge,std::vec p5 = (*It2).p + ((*It2).n * (-ToolSize)); p6 = (*It2).p + ((*It2).n * ToolSize); - cVAry.push_back(MeshGeomFacet(p3,p2,p6)); - cVAry.push_back(MeshGeomFacet(p3,p6,p4)); - cVAry.push_back(MeshGeomFacet(p1,p3,p4)); - cVAry.push_back(MeshGeomFacet(p1,p4,p5)); + cVAry.emplace_back(p3,p2,p6); + cVAry.emplace_back(p3,p6,p4); + cVAry.emplace_back(p1,p3,p4); + cVAry.emplace_back(p1,p4,p5); } @@ -705,7 +705,7 @@ void MeshProjection::discretize(const TopoDS_Edge& aEdge, std::vector 1) { HitPoint p1 = hitPoints[hitPoints.size()-2]; HitPoint p2 = hitPoints[hitPoints.size()-1]; - hitPointPairs.push_back(std::make_pair(p1, p2)); + hitPointPairs.emplace_back(p1, p2); } } } @@ -996,12 +996,12 @@ void MeshProjection::projectParallelToMesh (const std::vector &aEdges, Base::Vector3f result; unsigned long index; if (clAlg.NearestFacetOnRay(it, dir, cGrid, result, index)) { - hitPoints.push_back(std::make_pair(result, index)); + hitPoints.emplace_back(result, index); if (hitPoints.size() > 1) { HitPoint p1 = hitPoints[hitPoints.size()-2]; HitPoint p2 = hitPoints[hitPoints.size()-1]; - hitPointPairs.push_back(std::make_pair(p1, p2)); + hitPointPairs.emplace_back(p1, p2); } } } diff --git a/src/Mod/MeshPart/App/MeshAlgos.cpp b/src/Mod/MeshPart/App/MeshAlgos.cpp index 58c5ec5e88..c52ef1c068 100644 --- a/src/Mod/MeshPart/App/MeshAlgos.cpp +++ b/src/Mod/MeshPart/App/MeshAlgos.cpp @@ -571,8 +571,8 @@ void MeshAlgos::LoftOnCurve(MeshCore::MeshKernel &ResultMesh, const TopoDS_Shape p3 = prePoint[l], p4 = actPoint[l]; - cVAry.push_back(MeshGeomFacet(p1,p2,p3)); - cVAry.push_back(MeshGeomFacet(p3,p2,p4)); + cVAry.emplace_back(p1,p2,p3); + cVAry.emplace_back(p3,p2,p4); } } } diff --git a/src/Mod/MeshPart/Gui/CurveOnMesh.cpp b/src/Mod/MeshPart/Gui/CurveOnMesh.cpp index 6137e23a95..6ab95007ae 100644 --- a/src/Mod/MeshPart/Gui/CurveOnMesh.cpp +++ b/src/Mod/MeshPart/Gui/CurveOnMesh.cpp @@ -507,9 +507,9 @@ void CurveOnMeshHandler::approximateEdge(const TopoDS_Edge& edge, double toleran pts.reserve(numNodes); for (int i=aNodes.Lower(); i<=aNodes.Upper(); i++) { const gp_Pnt& p = aNodes.Value(i); - pts.push_back(SbVec3f(static_cast(p.X()), + pts.emplace_back(static_cast(p.X()), static_cast(p.Y()), - static_cast(p.Z()))); + static_cast(p.Z())); } d_ptr->curve->setPoints(pts); diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index b56fec4762..1e69c913fd 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -152,15 +152,15 @@ PartExport void getPyShapes(PyObject *obj, std::vector &shapes) { if(PyObject_TypeCheck(obj,&Part::TopoShapePy::Type)) shapes.push_back(*static_cast(obj)->getTopoShapePtr()); else if (PyObject_TypeCheck(obj, &GeometryPy::Type)) - shapes.push_back(TopoShape(static_cast(obj)->getGeometryPtr()->toShape())); + shapes.emplace_back(static_cast(obj)->getGeometryPtr()->toShape()); else if(PySequence_Check(obj)) { Py::Sequence list(obj); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) shapes.push_back(*static_cast((*it).ptr())->getTopoShapePtr()); else if (PyObject_TypeCheck((*it).ptr(), &GeometryPy::Type)) - shapes.push_back(TopoShape(static_cast( - (*it).ptr())->getGeometryPtr()->toShape())); + shapes.emplace_back(static_cast( + (*it).ptr())->getGeometryPtr()->toShape()); else throw Py::TypeError("expect shape in sequence"); } diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index 5e732ea759..06dcb534af 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -821,7 +821,7 @@ void AttachEngine::readLinks(const App::PropertyLinkSubList &references, shapes[i] = &(storage[storage.size()-1]); } else { Base::Console().Warning("Attacher: linked object %s is unexpected, assuming it has no shape.\n",geof->getNameInDocument()); - storage.push_back(TopoDS_Shape()); + storage.emplace_back(); shapes[i] = &(storage[storage.size()-1]); } diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakeOffsetFix.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakeOffsetFix.cpp index 7a1759dd92..f657693ba9 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakeOffsetFix.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakeOffsetFix.cpp @@ -82,7 +82,7 @@ void BRepOffsetAPI_MakeOffsetFix::AddWire(const TopoDS_Wire& Spine) edgeLocation = edge.Location(); edge.Location(TopLoc_Location()); mkWire.Add(edge); - myLocations.push_back(std::make_pair(edge, edgeLocation)); + myLocations.emplace_back(edge, edgeLocation); xp.Next(); } diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index f961b05381..d3b02b6c08 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -926,7 +926,7 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector v(*it); Base::Vector3d pnt = v.toVector(); - interpPoints.push_back(gp_Pnt(pnt.x,pnt.y,pnt.z)); + interpPoints.emplace_back(pnt.x,pnt.y,pnt.z); } GeomBSplineCurve* bspline = this->getGeomBSplineCurvePtr(); @@ -948,7 +948,7 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector v(*it); Base::Vector3d pnt = v.toVector(); - interpPoints.push_back(gp_Pnt(pnt.x,pnt.y,pnt.z)); + interpPoints.emplace_back(pnt.x,pnt.y,pnt.z); } Py::Sequence list2(tgs); diff --git a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp index df34db828b..724e976a5a 100644 --- a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp @@ -925,7 +925,7 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject * interpPoints.reserve(list.size()); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Base::Vector2d pnt = Py::toVector2d(*it); - interpPoints.push_back(gp_Pnt2d(pnt.x,pnt.y)); + interpPoints.emplace_back(pnt.x,pnt.y); } Geom2dBSplineCurve* bspline = this->getGeom2dBSplineCurvePtr(); @@ -952,7 +952,7 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject * interpPoints.reserve(list.size()); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Base::Vector2d pnt = Py::toVector2d(*it); - interpPoints.push_back(gp_Pnt2d(pnt.x,pnt.y)); + interpPoints.emplace_back(pnt.x,pnt.y); } Py::Sequence list2(tgs); diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 40dcdb5d87..adaa0ab3cf 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -887,7 +887,7 @@ std::vector GeomBezierCurve::getPoles() const for (Standard_Integer i=p.Lower(); i<=p.Upper(); i++) { const gp_Pnt& pnt = p(i); - poles.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + poles.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); } return poles; } @@ -1121,7 +1121,7 @@ std::vector GeomBSplineCurve::getPoles() const for (Standard_Integer i=p.Lower(); i<=p.Upper(); i++) { const gp_Pnt& pnt = p(i); - poles.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + poles.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); } return poles; } diff --git a/src/Mod/Part/App/Geometry2d.cpp b/src/Mod/Part/App/Geometry2d.cpp index 9794655339..96d99b93fd 100644 --- a/src/Mod/Part/App/Geometry2d.cpp +++ b/src/Mod/Part/App/Geometry2d.cpp @@ -466,7 +466,7 @@ std::vector Geom2dBSplineCurve::getPoles() const for (Standard_Integer i=p.Lower(); i<=p.Upper(); i++) { const gp_Pnt2d& pnt = p(i); - poles.push_back(Base::Vector2d(pnt.X(), pnt.Y())); + poles.emplace_back(pnt.X(), pnt.Y()); } return poles; } diff --git a/src/Mod/Part/App/Part2DObject.cpp b/src/Mod/Part/App/Part2DObject.cpp index 0b45547f48..1891f2ed62 100644 --- a/src/Mod/Part/App/Part2DObject.cpp +++ b/src/Mod/Part/App/Part2DObject.cpp @@ -165,8 +165,8 @@ bool Part2DObject::seekTrimPoints(const std::vector &geomlist, Part::GeomBoundedCurve * bcurve = static_cast(geomlist[id]); - points.push_back(gp_Pnt2d (bcurve->getStartPoint().x,bcurve->getStartPoint().y)); - points.push_back(gp_Pnt2d (bcurve->getEndPoint().x,bcurve->getEndPoint().y)); + points.emplace_back(bcurve->getStartPoint().x,bcurve->getStartPoint().y); + points.emplace_back(bcurve->getEndPoint().x,bcurve->getEndPoint().y); } Intersector.Init(primaryCurve, secondaryCurve, 1.0e-12); diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index ad02cb664a..a58e821ab1 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -3207,7 +3207,7 @@ void TopoShape::getDomains(std::vector& domains) const p.Transform(loc.Transformation()); Standard_Real X, Y, Z; p.Coord (X, Y, Z); - domain.points.push_back(Base::Vector3d(X, Y, Z)); + domain.points.emplace_back(X, Y, Z); } // copy the triangles @@ -3425,7 +3425,7 @@ void TopoShape::getPoints(std::vector &Points, for (TopExp_Explorer xp(_Shape, TopAbs_VERTEX, TopAbs_EDGE); xp.More(); xp.Next()) { gp_Pnt p = BRep_Tool::Pnt(TopoDS::Vertex(xp.Current())); Points.push_back(Base::convertTo(p)); - Normals.push_back(Base::Vector3d(0,0,0)); + Normals.emplace_back(0,0,0); } // sample inner points of all free edges @@ -3437,7 +3437,7 @@ void TopoShape::getPoints(std::vector &Points, for (int i=1; i<=nbPoints; i++) { gp_Pnt p = curve.Value (discretizer.Parameter(i)); Points.push_back(Base::convertTo(p)); - Normals.push_back(Base::Vector3d(0,0,0)); + Normals.emplace_back(0,0,0); } } } @@ -3511,7 +3511,7 @@ void TopoShape::getPoints(std::vector &Points, Normals.push_back(Base::convertTo(normal)); } else { - Normals.push_back(Base::Vector3d(0,0,0)); + Normals.emplace_back(0,0,0); } } } diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 74ca69c155..665b2c750d 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -228,9 +228,9 @@ PyObject* TopoShapePy::replaceShape(PyObject *args) Py::Tuple tuple(*it); Py::TopoShape sh1(tuple[0]); Py::TopoShape sh2(tuple[1]); - shapes.push_back(std::make_pair( + shapes.emplace_back( sh1.extensionObject()->getTopoShapePtr()->getShape(), - sh2.extensionObject()->getTopoShapePtr()->getShape()) + sh2.extensionObject()->getTopoShapePtr()->getShape() ); } PyTypeObject* type = this->GetType(); diff --git a/src/Mod/Part/App/modelRefine.cpp b/src/Mod/Part/App/modelRefine.cpp index a0750a7c9a..91c9a3d2e9 100644 --- a/src/Mod/Part/App/modelRefine.cpp +++ b/src/Mod/Part/App/modelRefine.cpp @@ -1074,7 +1074,7 @@ bool FaceUniter::process() if (!temp.empty()) { for (FaceVectorType::iterator f = temp.begin(); f != temp.end(); ++f) - modifiedShapes.push_back(std::make_pair(*f, newFace)); + modifiedShapes.emplace_back(*f, newFace); } } } @@ -1160,7 +1160,7 @@ bool FaceUniter::process() // Catch faces that were not united but whose boundary was changed (probably because // several adjacent faces were united) // See https://sourceforge.net/apps/mantisbt/free-cad/view.php?id=873 - modifiedShapes.push_back(std::make_pair(mapIt.Key(), mapIt.Value())); + modifiedShapes.emplace_back(mapIt.Key(), mapIt.Value()); } } // Handle edges that were fused. See https://sourceforge.net/apps/mantisbt/free-cad/view.php?id=873 @@ -1177,7 +1177,7 @@ bool FaceUniter::process() for (edgeIt.Initialize(edges); edgeIt.More(); edgeIt.Next()) { if (newEdges.IsBound(idx)) - modifiedShapes.push_back(std::make_pair(edgeIt.Value(), newEdges(idx))); + modifiedShapes.emplace_back(edgeIt.Value(), newEdges(idx)); } // TODO: Handle vertices that have disappeared in the fusion of the edges } diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index 64465f92ad..3d5de5e679 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -747,13 +747,13 @@ void TaskCheckGeometryResults::dispatchError(ResultEntry *entry, const BRepCheck void TaskCheckGeometryResults::setupFunctionMap() { - functionMap.push_back(FunctionMapType(TopAbs_SHELL, BRepCheck_NotClosed, goSetupResultShellNotClosed)); - functionMap.push_back(FunctionMapType(TopAbs_WIRE, BRepCheck_NotClosed, goSetupResultWireNotClosed)); - functionMap.push_back(FunctionMapType(TopAbs_VERTEX, BRepCheck_InvalidPointOnCurve, goSetupResultInvalidPointCurve)); - functionMap.push_back(FunctionMapType(TopAbs_FACE, BRepCheck_IntersectingWires, goSetupResultIntersectingWires)); - functionMap.push_back(FunctionMapType(TopAbs_EDGE, BRepCheck_InvalidCurveOnSurface, goSetupResultInvalidCurveSurface)); - functionMap.push_back(FunctionMapType(TopAbs_EDGE, BRepCheck_InvalidSameParameterFlag, goSetupResultInvalidSameParameterFlag)); - functionMap.push_back(FunctionMapType(TopAbs_FACE, BRepCheck_UnorientableShape, goSetupResultUnorientableShapeFace)); + functionMap.emplace_back(TopAbs_SHELL, BRepCheck_NotClosed, goSetupResultShellNotClosed); + functionMap.emplace_back(TopAbs_WIRE, BRepCheck_NotClosed, goSetupResultWireNotClosed); + functionMap.emplace_back(TopAbs_VERTEX, BRepCheck_InvalidPointOnCurve, goSetupResultInvalidPointCurve); + functionMap.emplace_back(TopAbs_FACE, BRepCheck_IntersectingWires, goSetupResultIntersectingWires); + functionMap.emplace_back(TopAbs_EDGE, BRepCheck_InvalidCurveOnSurface, goSetupResultInvalidCurveSurface); + functionMap.emplace_back(TopAbs_EDGE, BRepCheck_InvalidSameParameterFlag, goSetupResultInvalidSameParameterFlag); + functionMap.emplace_back(TopAbs_FACE, BRepCheck_UnorientableShape, goSetupResultUnorientableShapeFace); } void TaskCheckGeometryResults::currentRowChanged (const QModelIndex ¤t, const QModelIndex &previous) diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index e170df52b5..b76b9f4939 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -131,7 +131,7 @@ bool PartGui::evaluateLinearPreSelection(TopoDS_Shape &shape1, TopoDS_Shape &sha if (shape.IsNull()) break; shapes.push_back(shape); - sels[i].selections.push_back(DimSelections::DimSelection()); + sels[i].selections.emplace_back(); auto &sel = sels[i].selections[0]; ++i; sel.documentName = it->DocName; @@ -841,9 +841,9 @@ bool PartGui::evaluateAngularPreSelection(VectorAdapter &vector1Out, VectorAdapt sels.back().selections.back().shapeType!=DimSelections::Vertex || sels.back().selections.size()==1) { - sels.push_back(PartGui::DimSelections()); + sels.emplace_back(); } - sels.back().selections.push_back(DimSelections::DimSelection()); + sels.back().selections.emplace_back(); auto &sel = sels.back().selections.back(); sel.documentName = it->DocName; sel.objectName = it->FeatName; @@ -860,7 +860,7 @@ bool PartGui::evaluateAngularPreSelection(VectorAdapter &vector1Out, VectorAdapt { //need something here for 0 length vector. //create a point half way between to vertices. - adapters.push_back(VectorAdapter(currentVertex, lastVertex)); + adapters.emplace_back(currentVertex, lastVertex); lastVertex = TopoDS_Vertex(); } else @@ -880,8 +880,8 @@ bool PartGui::evaluateAngularPreSelection(VectorAdapter &vector1Out, VectorAdapt continue; } - sels.push_back(PartGui::DimSelections()); - sels.back().selections.push_back(DimSelections::DimSelection()); + sels.emplace_back(); + sels.back().selections.emplace_back(); auto &sel = sels.back().selections.back(); sel.documentName = it->DocName; sel.objectName = it->FeatName; @@ -908,7 +908,7 @@ bool PartGui::evaluateAngularPreSelection(VectorAdapter &vector1Out, VectorAdapt else edge.Orientation(TopAbs_FORWARD); } - adapters.push_back(VectorAdapter(edge, pickPoint)); + adapters.emplace_back(edge, pickPoint); continue; } @@ -916,7 +916,7 @@ bool PartGui::evaluateAngularPreSelection(VectorAdapter &vector1Out, VectorAdapt { sel.shapeType = DimSelections::Face; TopoDS_Face face = TopoDS::Face(shape); - adapters.push_back(VectorAdapter(face, pickPoint)); + adapters.emplace_back(face, pickPoint); continue; } } diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 102d9db36a..4b592f63a1 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -647,7 +647,7 @@ std::vector ViewProviderPartExt::getModelPoints(const SoPickedPo if (subShape.ShapeType() == TopAbs_VERTEX) { const TopoDS_Vertex& v = TopoDS::Vertex(subShape); gp_Pnt p = BRep_Tool::Pnt(v); - pts.push_back(Base::Vector3d(p.X(),p.Y(),p.Z())); + pts.emplace_back(p.X(),p.Y(),p.Z()); } // get the nearest point on the edge else if (subShape.ShapeType() == TopAbs_EDGE) { @@ -656,7 +656,7 @@ std::vector ViewProviderPartExt::getModelPoints(const SoPickedPo BRepExtrema_DistShapeShape distSS(subShape, mkVert.Vertex(), 0.1); if (distSS.NbSolution() > 0) { gp_Pnt p = distSS.PointOnShape1(1); - pts.push_back(Base::Vector3d(p.X(),p.Y(),p.Z())); + pts.emplace_back(p.X(),p.Y(),p.Z()); } } // get the nearest point on the face @@ -666,7 +666,7 @@ std::vector ViewProviderPartExt::getModelPoints(const SoPickedPo BRepExtrema_DistShapeShape distSS(subShape, mkVert.Vertex(), 0.1); if (distSS.NbSolution() > 0) { gp_Pnt p = distSS.PointOnShape1(1); - pts.push_back(Base::Vector3d(p.X(),p.Y(),p.Z())); + pts.emplace_back(p.X(),p.Y(),p.Z()); } } diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index 01ea877458..aa22c8c4a0 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -108,7 +108,7 @@ App::DocumentObjectExecReturn *Loft::execute(void) std::vector> wiresections; for(TopoDS_Wire& wire : wires) - wiresections.push_back(std::vector(1, wire)); + wiresections.emplace_back(1, wire); for(App::DocumentObject* obj : multisections) { if(!obj->isDerivedFrom(Part::Feature::getClassTypeId())) diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index 6d282c4c34..ae41478b3d 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -177,7 +177,7 @@ App::DocumentObjectExecReturn *Pipe::execute(void) auto multisections = Sections.getValues(); std::vector> wiresections; for(TopoDS_Wire& wire : wires) - wiresections.push_back(std::vector(1, wire)); + wiresections.emplace_back(1, wire); //maybe we need a sacling law Handle(Law_Function) scalinglaw; diff --git a/src/Mod/Path/libarea/Adaptive.cpp b/src/Mod/Path/libarea/Adaptive.cpp index c278abba84..8e138ec0b1 100644 --- a/src/Mod/Path/libarea/Adaptive.cpp +++ b/src/Mod/Path/libarea/Adaptive.cpp @@ -470,14 +470,14 @@ bool Line2CircleIntersect(const IntPoint &c, double radius, const IntPoint &p1, if (clamp) { if (t1 >= 0.0 && t1 <= 1.0) - result.push_back(DoublePoint(p1.X + t1 * dx, p1.Y + t1 * dy)); + result.emplace_back(p1.X + t1 * dx, p1.Y + t1 * dy); if (t2 >= 0.0 && t2 <= 1.0) - result.push_back(DoublePoint(p1.X + t2 * dx, p1.Y + t2 * dy)); + result.emplace_back(p1.X + t2 * dx, p1.Y + t2 * dy); } else { - result.push_back(DoublePoint(p1.X + t2 * dx, p1.Y + t2 * dy)); - result.push_back(DoublePoint(p1.X + t2 * dx, p1.Y + t2 * dy)); + result.emplace_back(p1.X + t2 * dx, p1.Y + t2 * dy); + result.emplace_back(p1.X + t2 * dx, p1.Y + t2 * dy); } return result.size() > 0; } @@ -617,7 +617,7 @@ void SmoothPaths(Paths &paths, double stepSize, long pointCount, long iterations { if (points.empty()) { - points.push_back(pair(i, pt)); + points.emplace_back(i, pt); continue; } const auto back=points.back(); @@ -629,7 +629,7 @@ void SmoothPaths(Paths &paths, double stepSize, long pointCount, long iterations if (l < 0.5*stepScaled ) { if(points.size()>1) points.pop_back(); - points.push_back(pair(i, pt)); + points.emplace_back(i, pt); continue; } size_t lastPathIndex = back.first; @@ -649,9 +649,9 @@ void SmoothPaths(Paths &paths, double stepSize, long pointCount, long iterations if(idx==0 && DistanceSqrd(back.second,ptx)1) points.pop_back(); if (p < 0.5) - points.push_back(pair(lastPathIndex, ptx)); + points.emplace_back(lastPathIndex, ptx); else - points.push_back(pair(i, ptx)); + points.emplace_back(i, ptx); } } } @@ -2137,7 +2137,7 @@ bool Adaptive2d::IsAllowedToCutTrough(const IntPoint &p1, const IntPoint &p2, Cl bool Adaptive2d::ResolveLinkPath(const IntPoint &startPoint, const IntPoint &endPoint, ClearedArea &clearedArea, Path &output) { vector> queue; - queue.push_back(pair(startPoint, endPoint)); + queue.emplace_back(startPoint, endPoint); Path checkPath; double totalLength = 0; double directDistance = sqrt(DistanceSqrd(startPoint, endPoint)); @@ -2262,8 +2262,8 @@ bool Adaptive2d::ResolveLinkPath(const IntPoint &startPoint, const IntPoint &end checkPath.push_back(checkPoint1); if (IsClearPath(checkPath, clearedArea, clearance + 1)) { // check if point clear - queue.push_back(pair(pointPair.first, checkPoint1)); - queue.push_back(pair(checkPoint1, pointPair.second)); + queue.emplace_back(pointPair.first, checkPoint1); + queue.emplace_back(checkPoint1, pointPair.second); break; } else @@ -2273,8 +2273,8 @@ bool Adaptive2d::ResolveLinkPath(const IntPoint &startPoint, const IntPoint &end checkPath.push_back(checkPoint2); if (IsClearPath(checkPath, clearedArea, clearance + 1)) { - queue.push_back(pair(pointPair.first, checkPoint2)); - queue.push_back(pair(checkPoint2, pointPair.second)); + queue.emplace_back(pointPair.first, checkPoint2); + queue.emplace_back(checkPoint2, pointPair.second); break; } } @@ -2483,7 +2483,7 @@ void Adaptive2d::AppendToolPath(TPaths &progressPaths, AdaptiveOutput &output, linkPath1.first = MotionType::mtCutting; for (const auto &pt : leadOutPath) { - linkPath1.second.push_back(DPoint(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor)); + linkPath1.second.emplace_back(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor); } output.AdaptivePaths.push_back(linkPath1); @@ -2492,7 +2492,7 @@ void Adaptive2d::AppendToolPath(TPaths &progressPaths, AdaptiveOutput &output, linkPath2.first = linkType; for (const auto &pt : linkPath) { - linkPath2.second.push_back(DPoint(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor)); + linkPath2.second.emplace_back(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor); } output.AdaptivePaths.push_back(linkPath2); @@ -2501,7 +2501,7 @@ void Adaptive2d::AppendToolPath(TPaths &progressPaths, AdaptiveOutput &output, linkPath3.first = MotionType::mtCutting; for (const auto &pt : leadInPath) { - linkPath3.second.push_back(DPoint(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor)); + linkPath3.second.emplace_back(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor); } output.AdaptivePaths.push_back(linkPath3); @@ -2527,8 +2527,8 @@ void Adaptive2d::AppendToolPath(TPaths &progressPaths, AdaptiveOutput &output, TPath linkPath; linkPath.first = mt; - linkPath.second.push_back(DPoint(double(startPoint.X) / scaleFactor, double(startPoint.Y) / scaleFactor)); - linkPath.second.push_back(DPoint(double(endPoint.X) / scaleFactor, double(endPoint.Y) / scaleFactor)); + linkPath.second.emplace_back(double(startPoint.X) / scaleFactor, double(startPoint.Y) / scaleFactor); + linkPath.second.emplace_back(double(endPoint.X) / scaleFactor, double(endPoint.Y) / scaleFactor); output.AdaptivePaths.push_back(linkPath); } } @@ -2580,8 +2580,8 @@ void Adaptive2d::AddPathsToProgress(TPaths &progressPaths, Paths paths, MotionTy progressPaths.push_back(TPath()); progressPaths.back().first = mt; for (const auto pt : pth) - progressPaths.back().second.push_back(DPoint(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor)); - progressPaths.back().second.push_back(DPoint(double(pth.front().X) / scaleFactor, double(pth.front().Y) / scaleFactor)); + progressPaths.back().second.emplace_back(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor); + progressPaths.back().second.emplace_back(double(pth.front().X) / scaleFactor, double(pth.front().Y) / scaleFactor); } } } @@ -2593,7 +2593,7 @@ void Adaptive2d::AddPathToProgress(TPaths &progressPaths, const Path pth, Motion progressPaths.push_back(TPath()); progressPaths.back().first = mt; for (const auto pt : pth) - progressPaths.back().second.push_back(DPoint(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor)); + progressPaths.back().second.emplace_back(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor); } } @@ -2922,7 +2922,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths) // append to progress info paths if (progressPaths.size() == 0) progressPaths.push_back(TPath()); - progressPaths.back().second.push_back(DPoint(double(newToolPos.X) / scaleFactor, double(newToolPos.Y) / scaleFactor)); + progressPaths.back().second.emplace_back(double(newToolPos.X) / scaleFactor, double(newToolPos.Y) / scaleFactor); // append gyro gyro.push_back(newToolDir); @@ -3069,7 +3069,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths) // show in progress cb for (auto &pt : finShiftedPath) { - progressPaths.back().second.push_back(DPoint(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor)); + progressPaths.back().second.emplace_back(double(pt.X) / scaleFactor, double(pt.Y) / scaleFactor); } if (!finShiftedPath.empty()) diff --git a/src/Mod/Path/libarea/Area.cpp b/src/Mod/Path/libarea/Area.cpp index 4a7ae894fa..4afaa5c3ee 100644 --- a/src/Mod/Path/libarea/Area.cpp +++ b/src/Mod/Path/libarea/Area.cpp @@ -392,7 +392,7 @@ static void make_zig_curve(const CCurve& input_curve, double y0, double y) } if(zig_finished) - zigzag_list_for_zigs.push_back(ZigZag(zig, zag)); + zigzag_list_for_zigs.emplace_back(zig, zag); } void make_zig(const CArea &a, double y0, double y) @@ -534,11 +534,11 @@ static void zigzag(const CArea &input_a) Point p2(x1, y); Point p3(x1, y0); CCurve c; - c.m_vertices.push_back(CVertex(0, p0, null_point, 0)); - c.m_vertices.push_back(CVertex(0, p1, null_point, 0)); - c.m_vertices.push_back(CVertex(0, p2, null_point, 1)); - c.m_vertices.push_back(CVertex(0, p3, null_point, 0)); - c.m_vertices.push_back(CVertex(0, p0, null_point, 1)); + c.m_vertices.emplace_back(0, p0, null_point, 0); + c.m_vertices.emplace_back(0, p1, null_point, 0); + c.m_vertices.emplace_back(0, p2, null_point, 1); + c.m_vertices.emplace_back(0, p3, null_point, 0); + c.m_vertices.emplace_back(0, p0, null_point, 1); CArea a2; a2.m_curves.push_back(c); a2.Intersect(a); @@ -635,7 +635,7 @@ void CArea::Split(std::list &m_areas)const for(std::list::const_iterator It = m_curves.begin(); It != m_curves.end(); It++) { const CCurve& curve = *It; - m_areas.push_back(CArea()); + m_areas.emplace_back(); m_areas.back().m_curves.push_back(curve); } } @@ -656,7 +656,7 @@ void CArea::Split(std::list &m_areas)const } else { - m_areas.push_back(CArea()); + m_areas.emplace_back(); m_areas.back().m_curves.push_back(curve); } } @@ -725,11 +725,11 @@ bool IsInside(const Point& p, const CArea& a) { CArea a2; CCurve c; - c.m_vertices.push_back(CVertex(Point(p.x - 0.01, p.y - 0.01))); - c.m_vertices.push_back(CVertex(Point(p.x + 0.01, p.y - 0.01))); - c.m_vertices.push_back(CVertex(Point(p.x + 0.01, p.y + 0.01))); - c.m_vertices.push_back(CVertex(Point(p.x - 0.01, p.y + 0.01))); - c.m_vertices.push_back(CVertex(Point(p.x - 0.01, p.y - 0.01))); + c.m_vertices.emplace_back(Point(p.x - 0.01, p.y - 0.01)); + c.m_vertices.emplace_back(Point(p.x + 0.01, p.y - 0.01)); + c.m_vertices.emplace_back(Point(p.x + 0.01, p.y + 0.01)); + c.m_vertices.emplace_back(Point(p.x - 0.01, p.y + 0.01)); + c.m_vertices.emplace_back(Point(p.x - 0.01, p.y - 0.01)); a2.m_curves.push_back(c); a2.Intersect(a); if(fabs(a2.GetArea()) < 0.0004)return false; diff --git a/src/Mod/Path/libarea/AreaClipper.cpp b/src/Mod/Path/libarea/AreaClipper.cpp index b2d485a83f..e887b85fb1 100644 --- a/src/Mod/Path/libarea/AreaClipper.cpp +++ b/src/Mod/Path/libarea/AreaClipper.cpp @@ -374,7 +374,7 @@ static void SetFromResult( CArea& area, TPolyPolygon& pp, bool reverse=true, boo { TPolygon& p = pp[i]; - area.m_curves.push_back(CCurve()); + area.m_curves.emplace_back(); CCurve &curve = area.m_curves.back(); SetFromResult(curve, p, reverse, is_closed); } diff --git a/src/Mod/Path/libarea/AreaDxf.cpp b/src/Mod/Path/libarea/AreaDxf.cpp index fa6293d247..5cbcd25266 100644 --- a/src/Mod/Path/libarea/AreaDxf.cpp +++ b/src/Mod/Path/libarea/AreaDxf.cpp @@ -13,7 +13,7 @@ void AreaDxfRead::StartCurveIfNecessary(const double* s) if((m_area->m_curves.size() == 0) || (m_area->m_curves.back().m_vertices.size() == 0) || (m_area->m_curves.back().m_vertices.back().m_p != ps)) { // start a new curve - m_area->m_curves.push_back(CCurve()); + m_area->m_curves.emplace_back(); m_area->m_curves.back().m_vertices.push_back(ps); } } @@ -27,5 +27,5 @@ void AreaDxfRead::OnReadLine(const double* s, const double* e) void AreaDxfRead::OnReadArc(const double* s, const double* e, const double* c, bool dir) { StartCurveIfNecessary(s); - m_area->m_curves.back().m_vertices.push_back(CVertex(dir?1:0, Point(e), Point(c))); + m_area->m_curves.back().m_vertices.emplace_back(dir?1:0, Point(e), Point(c)); } diff --git a/src/Mod/Path/libarea/AreaPocket.cpp b/src/Mod/Path/libarea/AreaPocket.cpp index 4e177a7f7d..8aa10f113a 100644 --- a/src/Mod/Path/libarea/AreaPocket.cpp +++ b/src/Mod/Path/libarea/AreaPocket.cpp @@ -135,7 +135,7 @@ void GetCurveItem::GetCurve(CCurve& output) std::list::iterator VIt = output.m_vertices.insert(this->EndIt, CVertex(inner.point_on_parent)); //inner.GetCurve(output); - GetCurveItem::to_do_list.push_back(GetCurveItem(&inner, VIt)); + GetCurveItem::to_do_list.emplace_back(&inner, VIt); } if(back().m_p != vertex.m_p)output.m_vertices.insert(this->EndIt, vertex); @@ -157,7 +157,7 @@ void GetCurveItem::GetCurve(CCurve& output) std::list::iterator VIt = output.m_vertices.insert(this->EndIt, CVertex(inner.point_on_parent)); //inner.GetCurve(output); - GetCurveItem::to_do_list.push_back(GetCurveItem(&inner, VIt)); + GetCurveItem::to_do_list.emplace_back(&inner, VIt); } } @@ -243,7 +243,7 @@ void CurveTree::MakeOffsets2() for(std::list::const_iterator It2 = island_and_offset->touching_offsets.begin(); It2 != island_and_offset->touching_offsets.end(); It2++) { const IslandAndOffset* touching = *It2; - touching_list.push_back(IslandAndOffsetLink(touching, inners.back())); + touching_list.emplace_back(touching, inners.back()); added.insert(touching); } @@ -276,7 +276,7 @@ void CurveTree::MakeOffsets2() { if(added.find(*It2)==added.end() && ((*It2) != island_and_offset)) { - touching_list.push_back(IslandAndOffsetLink(*It2, touching.add_to->inners.back())); + touching_list.emplace_back(*It2, touching.add_to->inners.back()); added.insert(*It2); } } @@ -501,10 +501,10 @@ void CArea::MakeOnePocketCurve(std::list &curve_list, const CAreaPocketP if(CArea::m_please_abort)return; CArea::m_processing_done = CArea::m_after_MakeOffsets_length; - curve_list.push_back(CCurve()); + curve_list.emplace_back(); CCurve& output = curve_list.back(); - GetCurveItem::to_do_list.push_back(GetCurveItem(&top_level, output.m_vertices.end())); + GetCurveItem::to_do_list.emplace_back(&top_level, output.m_vertices.end()); while(GetCurveItem::to_do_list.size() > 0) { diff --git a/src/Mod/Path/libarea/Curve.cpp b/src/Mod/Path/libarea/Curve.cpp index 2eaaefa2f1..827485c031 100644 --- a/src/Mod/Path/libarea/Curve.cpp +++ b/src/Mod/Path/libarea/Curve.cpp @@ -161,11 +161,11 @@ void CCurve::AddArcOrLines(bool check_for_arc, std::list &new_vertices, { if(arc.AlmostALine()) { - new_vertices.push_back(CVertex(arc.m_e, arc.m_user_data)); + new_vertices.emplace_back(arc.m_e, arc.m_user_data); } else { - new_vertices.push_back(CVertex(arc.m_dir ? 1:-1, arc.m_e, arc.m_c, arc.m_user_data)); + new_vertices.emplace_back(arc.m_dir ? 1:-1, arc.m_e, arc.m_c, arc.m_user_data); } arc_added = true; @@ -350,7 +350,7 @@ void CCurve::UnFitArcs() double nx = vertex.m_c.x * CArea::m_units + radius * cos(phi-dphi); double ny = vertex.m_c.y * CArea::m_units + radius * sin(phi-dphi); - new_pts.push_back(Point(nx, ny)); + new_pts.emplace_back(nx, ny); px = nx; py = ny; @@ -535,7 +535,7 @@ void CCurve::ChangeStart(const Point &p) { } else { - new_curve.m_vertices.push_back(CVertex(p)); + new_curve.m_vertices.emplace_back(p); started = true; start_span = span_index; if(p != vertex.m_p)new_curve.m_vertices.push_back(vertex); @@ -826,7 +826,7 @@ void CCurve::GetSpans(std::list &spans)const const CVertex& vertex = *It; if(prev_p) { - spans.push_back(Span(*prev_p, vertex)); + spans.emplace_back(*prev_p, vertex); } prev_p = &(vertex.m_p); } @@ -880,7 +880,7 @@ void CCurve::OffsetForward(double forwards_value, bool refit_arcs) // add an arc to the start of the next span int arc_type = ((sin_angle > 0) ? 1 : (-1)); Point centre = span.m_v.m_p - v * forwards_value; - m_vertices.push_back(CVertex(arc_type, next_span.m_p, centre)); + m_vertices.emplace_back(arc_type, next_span.m_p, centre); } } } @@ -978,7 +978,7 @@ void CCurve::operator+=(const CCurve& curve) { if((m_vertices.size() == 0) || (It->m_p != m_vertices.back().m_p)) { - m_vertices.push_back(CVertex(It->m_p)); + m_vertices.emplace_back(It->m_p); } } else @@ -1307,8 +1307,8 @@ void Span::Intersect(const Span& s, std::list &pts)const geoff_geometry::Point pInt1, pInt2; double t[4]; int num_int = MakeSpan(*this).Intof(MakeSpan(s), pInt1, pInt2, t); - if(num_int > 0)pts.push_back(Point(pInt1.x, pInt1.y)); - if(num_int > 1)pts.push_back(Point(pInt2.x, pInt2.y)); + if(num_int > 0)pts.emplace_back(pInt1.x, pInt1.y); + if(num_int > 1)pts.emplace_back(pInt2.x, pInt2.y); } void tangential_arc(const Point &p0, const Point &p1, const Point &v0, Point &c, int &dir) diff --git a/src/Mod/Path/libarea/PythonStuff.cpp b/src/Mod/Path/libarea/PythonStuff.cpp index a1b3005e72..e95d3ac834 100644 --- a/src/Mod/Path/libarea/PythonStuff.cpp +++ b/src/Mod/Path/libarea/PythonStuff.cpp @@ -139,7 +139,7 @@ static CArea AreaFromDxf(const char* filepath) static void append_point(CCurve& c, const Point& p) { - c.m_vertices.push_back(CVertex(p)); + c.m_vertices.emplace_back(p); } static boost::python::tuple nearest_point_to_curve(CCurve& c1, const CCurve& c2) diff --git a/src/Mod/Path/libarea/clipper.cpp b/src/Mod/Path/libarea/clipper.cpp index 9513132308..df93f06f3f 100644 --- a/src/Mod/Path/libarea/clipper.cpp +++ b/src/Mod/Path/libarea/clipper.cpp @@ -3884,7 +3884,7 @@ void ClipperOffset::DoOffset(double delta) if (node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon) m_normals.push_back(GetUnitNormal(m_srcPoly[len - 1], m_srcPoly[0])); else - m_normals.push_back(DoublePoint(m_normals[len - 2])); + m_normals.emplace_back(m_normals[len - 2]); if (node.m_endtype == etClosedPolygon) { diff --git a/src/Mod/Points/App/Points.cpp b/src/Mod/Points/App/Points.cpp index e9e80beac0..3dbe5074b4 100644 --- a/src/Mod/Points/App/Points.cpp +++ b/src/Mod/Points/App/Points.cpp @@ -156,10 +156,10 @@ std::vector PointKernel::getValidPoints() const if (!(boost::math::isnan(it->x) || boost::math::isnan(it->y) || boost::math::isnan(it->z))) - valid.push_back(value_type( + valid.emplace_back( static_cast(it->x), static_cast(it->y), - static_cast(it->z))); + static_cast(it->z)); } return valid; } diff --git a/src/Mod/Points/App/PointsAlgos.cpp b/src/Mod/Points/App/PointsAlgos.cpp index b4fe78d9b8..db7bb93385 100644 --- a/src/Mod/Points/App/PointsAlgos.cpp +++ b/src/Mod/Points/App/PointsAlgos.cpp @@ -613,7 +613,7 @@ void PlyReader::read(const std::string& filename) if (hasData && hasNormal) { normals.reserve(numPoints); for (std::size_t i=0; i(r)/255.0f, + colors.emplace_back(static_cast(r)/255.0f, static_cast(g)/255.0f, static_cast(b)/255.0f, - static_cast(a)/255.0f)); + static_cast(a)/255.0f); } } else if (types[red] == "float") { @@ -647,7 +647,7 @@ void PlyReader::read(const std::string& filename) float b = data(i, blue); if (alpha != max_size) a = data(i, alpha); - colors.push_back(App::Color(r, g, b, a)); + colors.emplace_back(r, g, b, a); } } } @@ -726,7 +726,7 @@ std::size_t PlyReader::readHeader(std::istream& in, else { // if another element than 'vertex' comes first then calculate the offset if (numPoints == 0) { - count_props.push_back(std::make_pair(count, 0)); + count_props.emplace_back(count, 0); } else { // this happens for elements coming after 'vertex' @@ -1062,7 +1062,7 @@ void PcdReader::read(const std::string& filename) if (hasData && hasNormal) { normals.reserve(numPoints); for (std::size_t i=0; i> 16) & 0xff; uint32_t g = (packed >> 8) & 0xff; uint32_t b = packed & 0xff; - colors.push_back(App::Color(static_cast(r)/255.0f, + colors.emplace_back(static_cast(r)/255.0f, static_cast(g)/255.0f, static_cast(b)/255.0f, - static_cast(a)/255.0f)); + static_cast(a)/255.0f); } } else if (types[rgba] == "F") { @@ -1102,10 +1102,10 @@ void PcdReader::read(const std::string& filename) uint32_t r = (packed >> 16) & 0xff; uint32_t g = (packed >> 8) & 0xff; uint32_t b = packed & 0xff; - colors.push_back(App::Color(static_cast(r)/255.0f, + colors.emplace_back(static_cast(r)/255.0f, static_cast(g)/255.0f, static_cast(b)/255.0f, - static_cast(a)/255.0f)); + static_cast(a)/255.0f); } } } diff --git a/src/Mod/ReverseEngineering/App/AppReverseEngineering.cpp b/src/Mod/ReverseEngineering/App/AppReverseEngineering.cpp index 5d618f110a..bd71d5bb50 100644 --- a/src/Mod/ReverseEngineering/App/AppReverseEngineering.cpp +++ b/src/Mod/ReverseEngineering/App/AppReverseEngineering.cpp @@ -218,10 +218,10 @@ private: pts.reserve(l.size()); for (Py::Sequence::iterator it = l.begin(); it != l.end(); ++it) { Py::Tuple t(*it); - pts.push_back(Base::Vector3f( + pts.emplace_back( (float)Py::Float(t.getItem(0)), (float)Py::Float(t.getItem(1)), - (float)Py::Float(t.getItem(2))) + (float)Py::Float(t.getItem(2)) ); } } diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp index 171859ab52..f8654163a2 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp @@ -638,7 +638,7 @@ bool ParameterCorrection::GetUVParameters(double fSizeFactor) for (int ii=_pvcPoints->Lower(); ii<=_pvcPoints->Upper(); ii++) { const gp_Pnt& pnt = (*_pvcPoints)(ii); Wm4::Vector3d clProjPnt = clRotMatTrans * Wm4::Vector3d(pnt.X(), pnt.Y(), pnt.Z()); - vcProjPts.push_back(Base::Vector2d(clProjPnt.X(), clProjPnt.Y())); + vcProjPts.emplace_back(clProjPnt.X(), clProjPnt.Y()); clBBox.Add(Base::Vector2d(clProjPnt.X(), clProjPnt.Y())); } diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 4640d67e1f..5a2ba85786 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -3021,7 +3021,7 @@ bool Sketch::updateGeometry() std::vector::const_iterator it2; for( it1 = mybsp.poles.begin(), it2 = mybsp.weights.begin(); it1 != mybsp.poles.end() && it2 != mybsp.weights.end(); ++it1, ++it2) { - poles.push_back(Vector3d( *(*it1).x , *(*it1).y , 0.0)); + poles.emplace_back( *(*it1).x , *(*it1).y , 0.0); weights.push_back(*(*it2)); } diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 3978b3604d..650b880f74 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -5287,7 +5287,7 @@ int SketchObject::addExternal(App::DocumentObject *Obj, const char* SubName) // add the new ones Objects.push_back(Obj); - SubElements.push_back(std::string(SubName)); + SubElements.emplace_back(SubName); // set the Link list. ExternalGeometry.setValues(Objects,SubElements); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 22e79961d2..e7b54db4ba 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3554,7 +3554,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer int stdcountsegments = hGrp->GetInt("SegmentsPerGeometry", 50); // RootPoint - Points.push_back(Base::Vector3d(0.,0.,0.)); + Points.emplace_back(0.,0.,0.); for (std::vector::const_iterator it = geomlist->begin(); it != geomlist->end()-2; ++it, GeoId++) { if (GeoId >= intGeoCount) @@ -3585,11 +3585,11 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer double segment = (2 * M_PI) / countSegments; for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(i*segment); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); } gp_Pnt pnt = curve->Value(0); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); @@ -3605,11 +3605,11 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer double segment = (2 * M_PI) / countSegments; for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(i*segment); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); } gp_Pnt pnt = curve->Value(0); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); @@ -3635,13 +3635,13 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(startangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); startangle += segment; } // end point gp_Pnt pnt = curve->Value(endangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); @@ -3671,13 +3671,13 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(startangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); startangle += segment; } // end point gp_Pnt pnt = curve->Value(endangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); @@ -3707,13 +3707,13 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(startangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); startangle += segment; } // end point gp_Pnt pnt = curve->Value(endangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); @@ -3743,13 +3743,13 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(startangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); startangle += segment; } // end point gp_Pnt pnt = curve->Value(endangle); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); @@ -3779,13 +3779,13 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer for (int i=0; i < countSegments; i++) { gp_Pnt pnt = curve->Value(first); - Coords.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + Coords.emplace_back(pnt.X(), pnt.Y(), pnt.Z()); first += segment; } // end point gp_Pnt end = curve->Value(last); - Coords.push_back(Base::Vector3d(end.X(), end.Y(), end.Z())); + Coords.emplace_back(end.X(), end.Y(), end.Z()); Index.push_back(countSegments+1); edit->CurvIdToGeoId.push_back(GeoId); diff --git a/src/Mod/Spreadsheet/Gui/Command.cpp b/src/Mod/Spreadsheet/Gui/Command.cpp index becd079d45..6b4152537b 100644 --- a/src/Mod/Spreadsheet/Gui/Command.cpp +++ b/src/Mod/Spreadsheet/Gui/Command.cpp @@ -812,8 +812,8 @@ void CmdSpreadsheetSetAlias::activated(int iMsg) if (selection.size() == 1) { std::vector range; - range.push_back(Range(selection[0].row(), selection[0].column(), - selection[0].row(), selection[0].column())); + range.emplace_back(selection[0].row(), selection[0].column(), + selection[0].row(), selection[0].column()); std::unique_ptr dialog(new PropertiesDialog(sheet, range, sheetView)); diff --git a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp index 30964d17e0..8285e1520e 100644 --- a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp @@ -137,8 +137,8 @@ std::vector SheetTableView::selectedRanges() const std::pair ul = (*i).first; std::pair size = (*i).second; - result.push_back(Range(ul.first, ul.second, - ul.first + size.first - 1, ul.second + size.second - 1)); + result.emplace_back(ul.first, ul.second, + ul.first + size.first - 1, ul.second + size.second - 1); } return result; diff --git a/src/Mod/Surface/Gui/TaskFilling.cpp b/src/Mod/Surface/Gui/TaskFilling.cpp index 9f47ef62b0..d8895b362d 100644 --- a/src/Mod/Surface/Gui/TaskFilling.cpp +++ b/src/Mod/Surface/Gui/TaskFilling.cpp @@ -621,7 +621,7 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg) // extend faces and continuities lists if needed auto faces = editedObject->BoundaryFaces.getValues(); if (count == faces.size()) { - faces.push_back(std::string()); + faces.emplace_back(); editedObject->BoundaryFaces.setValues(faces); } auto conts = editedObject->BoundaryOrder.getValues(); diff --git a/src/Mod/Surface/Gui/TaskFillingUnbound.cpp b/src/Mod/Surface/Gui/TaskFillingUnbound.cpp index 5ee64ff84c..161dc602df 100644 --- a/src/Mod/Surface/Gui/TaskFillingUnbound.cpp +++ b/src/Mod/Surface/Gui/TaskFillingUnbound.cpp @@ -401,7 +401,7 @@ void FillingUnboundPanel::onSelectionChanged(const Gui::SelectionChanges& msg) // extend faces and continuities lists if needed auto faces = editedObject->UnboundFaces.getValues(); if (count == faces.size()) { - faces.push_back(std::string()); + faces.emplace_back(); editedObject->UnboundFaces.setValues(faces); } auto conts = editedObject->UnboundOrder.getValues(); diff --git a/src/Mod/TechDraw/App/DrawParametricTemplate.cpp b/src/Mod/TechDraw/App/DrawParametricTemplate.cpp index f902841d96..b4a1c2cce8 100644 --- a/src/Mod/TechDraw/App/DrawParametricTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawParametricTemplate.cpp @@ -119,8 +119,8 @@ int DrawParametricTemplate::drawLine(double x1, double y1, double x2, double y2) { TechDraw::Generic *line = new TechDraw::Generic(); - line->points.push_back(Base::Vector3d(x1, y1)); - line->points.push_back(Base::Vector3d(x2, y2)); + line->points.emplace_back(x1, y1); + line->points.emplace_back(x2, y2); geom.push_back(line); // Push onto geometry stack return geom.size() -1; diff --git a/src/Mod/TechDraw/App/Geometry.cpp b/src/Mod/TechDraw/App/Geometry.cpp index cb36368473..9fcc65ae10 100644 --- a/src/Mod/TechDraw/App/Geometry.cpp +++ b/src/Mod/TechDraw/App/Geometry.cpp @@ -242,9 +242,9 @@ std::vector BaseGeom::findEndPoints() if (!occEdge.IsNull()) { gp_Pnt p = BRep_Tool::Pnt(TopExp::FirstVertex(occEdge)); - result.push_back(Base::Vector3d(p.X(),p.Y(), p.Z())); + result.emplace_back(p.X(),p.Y(), p.Z()); p = BRep_Tool::Pnt(TopExp::LastVertex(occEdge)); - result.push_back(Base::Vector3d(p.X(),p.Y(), p.Z())); + result.emplace_back(p.X(),p.Y(), p.Z()); } else { //TODO: this should throw something Base::Console().Message("Geometry::findEndPoints - OCC edge not found\n"); @@ -306,13 +306,13 @@ std::vector BaseGeom::getQuads() double q3 = u + (3.0 * range / 4.0); BRepLProp_CLProps prop(adapt,q1,0,Precision::Confusion()); const gp_Pnt& p1 = prop.Value(); - result.push_back(Base::Vector3d(p1.X(),p1.Y(), 0.0)); + result.emplace_back(p1.X(),p1.Y(), 0.0); prop.SetParameter(q2); const gp_Pnt& p2 = prop.Value(); - result.push_back(Base::Vector3d(p2.X(),p2.Y(), 0.0)); + result.emplace_back(p2.X(),p2.Y(), 0.0); prop.SetParameter(q3); const gp_Pnt& p3 = prop.Value(); - result.push_back(Base::Vector3d(p3.X(),p3.Y(), 0.0)); + result.emplace_back(p3.X(),p3.Y(), 0.0); return result; } @@ -828,14 +828,14 @@ Generic::Generic(const TopoDS_Edge &e) if (!polygon.IsNull()) { const TColgp_Array1OfPnt &nodes = polygon->Nodes(); for (int i = nodes.Lower(); i <= nodes.Upper(); i++){ - points.push_back(Base::Vector3d(nodes(i).X(), nodes(i).Y(), nodes(i).Z())); + points.emplace_back(nodes(i).X(), nodes(i).Y(), nodes(i).Z()); } } else { //no polygon representation? approximate with line gp_Pnt p = BRep_Tool::Pnt(TopExp::FirstVertex(occEdge)); - points.push_back(Base::Vector3d(p.X(), p.Y(), p.Z())); + points.emplace_back(p.X(), p.Y(), p.Z()); p = BRep_Tool::Pnt(TopExp::LastVertex(occEdge)); - points.push_back(Base::Vector3d(p.X(), p.Y(), p.Z())); + points.emplace_back(p.X(), p.Y(), p.Z()); } } @@ -1036,7 +1036,7 @@ BSpline::BSpline(const TopoDS_Edge &e) tempSegment.degree = bezier->Degree(); for (int pole = 1; pole <= tempSegment.poles; ++pole) { controlPoint = bezier->Pole(pole); - tempSegment.pnts.push_back(Base::Vector3d(controlPoint.X(), controlPoint.Y(), controlPoint.Z())); + tempSegment.pnts.emplace_back(controlPoint.X(), controlPoint.Y(), controlPoint.Z()); } segments.push_back(tempSegment); } @@ -1306,7 +1306,7 @@ BezierSegment::BezierSegment(const TopoDS_Edge &e) } for (int i = 1; i <= poles; ++i) { gp_Pnt controlPoint = bez->Pole(i); - pnts.push_back(Base::Vector3d(controlPoint.X(), controlPoint.Y(), controlPoint.Z())); + pnts.emplace_back(controlPoint.X(), controlPoint.Y(), controlPoint.Z()); } }