From b5f021ff9f2281e7b64c0625ae36e4f6fa7b15bc Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 5 Dec 2019 07:41:21 -0800 Subject: [PATCH] Cleanup: Replace push_back with emplace_back In cases where we create a new item and immediately push into a container, the emplace idiom is faster and more efficient. --- 3d-viewer/3d_cache/sg/sg_colors.cpp | 2 +- 3d-viewer/3d_cache/sg/sg_coords.cpp | 2 +- 3d-viewer/3d_cache/sg/sg_helpers.cpp | 4 +- 3d-viewer/3d_cache/sg/sg_normals.cpp | 2 +- .../c3d_render_createscene_ogl_legacy.cpp | 8 +- .../c3d_render_raytracing.cpp | 2 +- common/basic_gal.cpp | 2 +- common/eagle_parser.cpp | 2 +- common/filename_resolver.cpp | 2 +- common/gal/opengl/cached_container.cpp | 2 +- common/gal/opengl/opengl_gal.cpp | 2 +- common/geometry/convex_hull.cpp | 2 +- common/geometry/shape_line_chain.cpp | 2 +- common/gr_basic.cpp | 2 +- common/marker_base.cpp | 4 +- common/page_layout/ws_draw_item.cpp | 4 +- common/plotters/DXF_plotter.cpp | 2 +- common/plotters/GERBER_plotter.cpp | 4 +- common/plotters/HPGL_plotter.cpp | 14 +-- common/plotters/PS_plotter.cpp | 4 +- common/plotters/common_plot_functions.cpp | 4 +- common/plotters/plotter.cpp | 4 +- common/widgets/mathplot.cpp | 10 +- dxflib_qcad/dl_dxf.cpp | 4 +- eeschema/lib_arc.cpp | 4 +- eeschema/lib_bezier.cpp | 6 +- eeschema/lib_pin.cpp | 8 +- .../netlist_exporter_orcadpcb2.cpp | 2 +- eeschema/sim/ngspice.cpp | 4 +- gerbview/evaluate.cpp | 2 +- gerbview/excellon_read_drill_file.cpp | 12 +-- gerbview/gerber_draw_item.cpp | 16 ++-- include/eagle_parser.h | 2 +- include/geometry/poly_grid_partition.h | 2 +- include/tool/edit_points.h | 2 +- kicad/project_template.cpp | 2 +- pcbnew/class_board.cpp | 12 +-- pcbnew/class_drawsegment.cpp | 30 +++--- pcbnew/class_edge_mod.cpp | 4 +- pcbnew/class_pad.cpp | 28 +++--- pcbnew/class_pcb_text.cpp | 18 ++-- pcbnew/class_text_mod.cpp | 20 ++-- pcbnew/class_track.cpp | 40 ++++---- .../dialog_pad_basicshapes_properties.cpp | 4 +- .../dialogs/panel_pcbnew_action_plugins.cpp | 4 +- pcbnew/eagle_plugin.cpp | 10 +- pcbnew/exporters/export_vrml.cpp | 12 +-- pcbnew/exporters/gendrill_Excellon_writer.cpp | 2 +- .../exporters/gendrill_file_writer_base.cpp | 4 +- pcbnew/exporters/gendrill_gerber_writer.cpp | 2 +- pcbnew/footprint_info_impl.cpp | 6 +- pcbnew/import_gfx/dxf_import_plugin.cpp | 6 +- pcbnew/legacy_plugin.cpp | 6 +- pcbnew/netinfo_item.cpp | 14 +-- pcbnew/pad_custom_shape_functions.cpp | 2 +- pcbnew/pcb_draw_panel_gal.cpp | 12 +-- pcbnew/pcb_general_settings.cpp | 2 +- pcbnew/ratsnest_data.cpp | 4 +- pcbnew/router/pns_diff_pair.cpp | 20 ++-- plugins/3d/idf/s3d_plugin_idf.cpp | 2 +- plugins/3d/oce/loadmodel.cpp | 2 +- plugins/3d/vrml/v2/vrml2_box.cpp | 96 +++++++++---------- plugins/3d/vrml/wrlfacet.cpp | 2 +- polygon/clipper.cpp | 2 +- qa/common/geometry/fixtures_geometry.h | 50 +++++----- .../test_shape_poly_set_collision.cpp | 12 +-- .../geometry/test_shape_poly_set_iterator.cpp | 6 +- utils/idftools/vrml_layer.cpp | 2 +- 68 files changed, 294 insertions(+), 294 deletions(-) diff --git a/3d-viewer/3d_cache/sg/sg_colors.cpp b/3d-viewer/3d_cache/sg/sg_colors.cpp index d80bdc749a..16718da05e 100644 --- a/3d-viewer/3d_cache/sg/sg_colors.cpp +++ b/3d-viewer/3d_cache/sg/sg_colors.cpp @@ -185,7 +185,7 @@ void SGCOLORS::SetColorList( size_t aListSize, const SGCOLOR* aColorList ) void SGCOLORS::AddColor( double aRedValue, double aGreenValue, double aBlueValue ) { - colors.push_back( SGCOLOR( aRedValue, aGreenValue, aBlueValue ) ); + colors.emplace_back( aRedValue, aGreenValue, aBlueValue ); return; } diff --git a/3d-viewer/3d_cache/sg/sg_coords.cpp b/3d-viewer/3d_cache/sg/sg_coords.cpp index 242f87d869..da72669dd2 100644 --- a/3d-viewer/3d_cache/sg/sg_coords.cpp +++ b/3d-viewer/3d_cache/sg/sg_coords.cpp @@ -188,7 +188,7 @@ void SGCOORDS::SetCoordsList( size_t aListSize, const SGPOINT* aCoordsList ) void SGCOORDS::AddCoord( double aXValue, double aYValue, double aZValue ) { - coords.push_back( SGPOINT( aXValue, aYValue, aZValue ) ); + coords.emplace_back( aXValue, aYValue, aZValue ); return; } diff --git a/3d-viewer/3d_cache/sg/sg_helpers.cpp b/3d-viewer/3d_cache/sg/sg_helpers.cpp index fec16bfef3..60103ea811 100644 --- a/3d-viewer/3d_cache/sg/sg_helpers.cpp +++ b/3d-viewer/3d_cache/sg/sg_helpers.cpp @@ -503,7 +503,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords, // assign any skipped coordinates a normal of (0,0,1) while( item > idx ) { - norms.push_back( SGVECTOR( 0, 0, 1 ) ); + norms.emplace_back( 0, 0, 1 ); ++idx; } @@ -517,7 +517,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords, ++sT; } - norms.push_back( SGVECTOR( norm.x, norm.y, norm.z ) ); + norms.emplace_back( norm.x, norm.y, norm.z ); ++idx; ++sM; diff --git a/3d-viewer/3d_cache/sg/sg_normals.cpp b/3d-viewer/3d_cache/sg/sg_normals.cpp index c3bc11a2b2..6fac6cfa85 100644 --- a/3d-viewer/3d_cache/sg/sg_normals.cpp +++ b/3d-viewer/3d_cache/sg/sg_normals.cpp @@ -186,7 +186,7 @@ void SGNORMALS::SetNormalList( size_t aListSize, const SGVECTOR* aNormalList ) void SGNORMALS::AddNormal( double aXValue, double aYValue, double aZValue ) { - norms.push_back( SGVECTOR( aXValue, aYValue, aZValue ) ); + norms.emplace_back( aXValue, aYValue, aZValue ); return; } diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp index a6a3c66b04..e4881d148e 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp @@ -112,11 +112,11 @@ void C3D_RENDER_OGL_LEGACY::generate_ring_contour( const SFVEC2F &aCenter, * 2.0f * glm::pi() / 3600.0f; const SFVEC2F rotatedDir = SFVEC2F( cos( angle ), sin( angle ) ); - aInnerContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aInnerRadius, - aCenter.y + rotatedDir.y * aInnerRadius ) ); + aInnerContourResult.emplace_back( aCenter.x + rotatedDir.x * aInnerRadius, + aCenter.y + rotatedDir.y * aInnerRadius ); - aOuterContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aOuterRadius, - aCenter.y + rotatedDir.y * aOuterRadius ) ); + aOuterContourResult.emplace_back( aCenter.x + rotatedDir.x * aOuterRadius, + aCenter.y + rotatedDir.y * aOuterRadius ); } aInnerContourResult.push_back( aInnerContourResult[0] ); diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp index 42e1bb2439..ecdda56466 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp @@ -2141,7 +2141,7 @@ void C3D_RENDER_RAYTRACING::initialize_block_positions() for( int x = 0; x < blocks_x; ++x ) for( int y = 0; y < blocks_y; ++y ) - m_blockPositions.push_back( SFVEC2UI( x * RAYPACKET_DIM, y * RAYPACKET_DIM ) ); + m_blockPositions.emplace_back( x * RAYPACKET_DIM, y * RAYPACKET_DIM ); const SFVEC2UI center( m_realBufferSize.x / 2, m_realBufferSize.y / 2 ); std::sort( m_blockPositions.begin(), m_blockPositions.end(), diff --git a/common/basic_gal.cpp b/common/basic_gal.cpp index 02ddc7deb6..d45ec54241 100644 --- a/common/basic_gal.cpp +++ b/common/basic_gal.cpp @@ -62,7 +62,7 @@ void BASIC_GAL::DrawPolyline( const std::deque& aPointList ) for( ; it != aPointList.end(); ++it ) { VECTOR2D corner = transform(*it); - polyline_corners.push_back( wxPoint( corner.x, corner.y ) ); + polyline_corners.emplace_back( corner.x, corner.y ); } if( m_DC ) diff --git a/common/eagle_parser.cpp b/common/eagle_parser.cpp index d80f73f951..9f38ad4a31 100644 --- a/common/eagle_parser.cpp +++ b/common/eagle_parser.cpp @@ -1035,7 +1035,7 @@ EDEVICE::EDEVICE( wxXmlNode* aDevice ) while( connectNode ) { - connects.push_back( ECONNECT( connectNode ) ); + connects.emplace_back( connectNode ); connectNode = connectNode->GetNext(); } } diff --git a/common/filename_resolver.cpp b/common/filename_resolver.cpp index 2e6b7ec304..647c093c17 100644 --- a/common/filename_resolver.cpp +++ b/common/filename_resolver.cpp @@ -1071,7 +1071,7 @@ bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths ) } if( !hasKisys3D ) - paths.push_back( "${KISYS3DMOD}" ); + paths.emplace_back("${KISYS3DMOD}" ); return true; } diff --git a/common/gal/opengl/cached_container.cpp b/common/gal/opengl/cached_container.cpp index 3d7f68b14a..5f4b3794a5 100644 --- a/common/gal/opengl/cached_container.cpp +++ b/common/gal/opengl/cached_container.cpp @@ -329,7 +329,7 @@ void CACHED_CONTAINER::mergeFreeChunks() for( it = m_freeChunks.begin(), it_end = m_freeChunks.end(); it != it_end; ++it ) { - freeChunks.push_back( std::make_pair( it->second, it->first ) ); + freeChunks.emplace_back( it->second, it->first ); } m_freeChunks.clear(); diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index fba5d930bc..85d3ce2a5b 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -2065,7 +2065,7 @@ void CALLBACK CombineCallback( GLdouble coords[3], OPENGL_GAL::TessParams* param = static_cast( aData ); // Save the pointer so we can delete it later - param->intersectPoints.push_back( boost::shared_array( vertex ) ); + param->intersectPoints.emplace_back( vertex ); memcpy( vertex, coords, 3 * sizeof(GLdouble) ); diff --git a/common/geometry/convex_hull.cpp b/common/geometry/convex_hull.cpp index 4550bce784..d2847a9181 100644 --- a/common/geometry/convex_hull.cpp +++ b/common/geometry/convex_hull.cpp @@ -151,7 +151,7 @@ void BuildConvexHull( std::vector& aResult, for( int ii = 0; ii < poly.PointCount(); ++ii ) { - buf.push_back( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) ); + buf.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y ); } } diff --git a/common/geometry/shape_line_chain.cpp b/common/geometry/shape_line_chain.cpp index 851e70e386..94d5717e97 100644 --- a/common/geometry/shape_line_chain.cpp +++ b/common/geometry/shape_line_chain.cpp @@ -675,7 +675,7 @@ bool SHAPE_LINE_CHAIN::Parse( std::stringstream& aStream ) int x, y; aStream >> x; aStream >> y; - m_points.push_back( VECTOR2I( x, y ) ); + m_points.emplace_back( x, y ); } return true; diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index b2ea5da89a..6d14ecfc4c 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -985,7 +985,7 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n ) for( cpointIterator cit = outputPolygon.begin(); cit != outputPolygon.end(); ++cit ) { - clippedPolygon.push_back( wxPoint( KiROUND( cit->X ), KiROUND( cit->Y ) ) ); + clippedPolygon.emplace_back( KiROUND( cit->X ), KiROUND( cit->Y ) ); } if( clippedPolygon.size() ) diff --git a/common/marker_base.cpp b/common/marker_base.cpp index 97149a6588..1d1112417f 100644 --- a/common/marker_base.cpp +++ b/common/marker_base.cpp @@ -246,8 +246,8 @@ void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset ) for( int ii = 0; ii < ccount; ii++ ) { - shape.push_back( wxPoint( GetShapePolygonCorner( ii ).x * MarkerScale(), - GetShapePolygonCorner( ii ).y * MarkerScale() ) ); + shape.emplace_back( GetShapePolygonCorner( ii ).x * MarkerScale(), + GetShapePolygonCorner( ii ).y * MarkerScale() ); } for( int ii = 0; ii < ccount; ii++ ) diff --git a/common/page_layout/ws_draw_item.cpp b/common/page_layout/ws_draw_item.cpp index 4c046a2292..0a437a1f0c 100644 --- a/common/page_layout/ws_draw_item.cpp +++ b/common/page_layout/ws_draw_item.cpp @@ -200,8 +200,8 @@ void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx ); for( int ii = 0; ii < outline.PointCount(); ii++ ) - points_moved.push_back( wxPoint( outline.Point( ii ).x + aOffset.x, - outline.Point( ii ).y + aOffset.y ) ); + points_moved.emplace_back( outline.Point( ii ).x + aOffset.x, + outline.Point( ii ).y + aOffset.y ); GRPoly( nullptr, aDC, points_moved.size(), &points_moved[0], FILLED_SHAPE, GetPenWidth(), aColor, aColor ); diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index aebb85856f..867cf47f49 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -619,7 +619,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline(0 ); for( int jj = 0; jj < path.PointCount(); jj++ ) - cornerList.push_back( wxPoint( path.CPoint( jj ).x , path.CPoint( jj ).y ) ); + cornerList.emplace_back( path.CPoint( jj ).x , path.CPoint( jj ).y ); // Ensure the polygon is closed if( cornerList[0] != cornerList[cornerList.size() - 1] ) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 1d2610426e..88648bf9c7 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -902,7 +902,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS cornerList.reserve( poly.PointCount() + 1 ); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); + cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y ); // Close polygon cornerList.push_back( cornerList[0] ); @@ -942,7 +942,7 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize cornerList.clear(); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); + cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y ); // Close polygon cornerList.push_back( cornerList[0] ); diff --git a/common/plotters/HPGL_plotter.cpp b/common/plotters/HPGL_plotter.cpp index 9c32907274..639994e446 100644 --- a/common/plotters/HPGL_plotter.cpp +++ b/common/plotters/HPGL_plotter.cpp @@ -603,12 +603,12 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, } - corners.push_back( wxPoint( - dx, - dy ) ); - corners.push_back( wxPoint( - dx, + dy ) ); - corners.push_back( wxPoint( + dx, + dy ) ); - corners.push_back( wxPoint( + dx, - dy ) ); + corners.emplace_back( - dx, - dy ); + corners.emplace_back( - dx, + dy ); + corners.emplace_back( + dx, + dy ); + corners.emplace_back( + dx, - dy ); // Close polygon - corners.push_back( wxPoint( - dx, - dy ) ); + corners.emplace_back( - dx, - dy ); for( unsigned ii = 0; ii < corners.size(); ii++ ) { @@ -649,7 +649,7 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz SHAPE_LINE_CHAIN& poly = outline.Outline( 0 ); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); + cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y ); if( cornerList.back() != cornerList.front() ) cornerList.push_back( cornerList.front() ); @@ -671,7 +671,7 @@ void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, cornerList.reserve( poly.PointCount() ); for( int ii = 1; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); + cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y ); if( cornerList.back() != cornerList.front() ) cornerList.push_back( cornerList.front() ); diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp index 7ccfba329b..3a91444ed9 100644 --- a/common/plotters/PS_plotter.cpp +++ b/common/plotters/PS_plotter.cpp @@ -208,7 +208,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS SHAPE_LINE_CHAIN& poly = outline.Outline( 0 ); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); + cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y ); // Close polygon cornerList.push_back( cornerList[0] ); @@ -241,7 +241,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize cornerList.clear(); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); + cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y ); // Close polygon cornerList.push_back( cornerList[0] ); diff --git a/common/plotters/common_plot_functions.cpp b/common/plotters/common_plot_functions.cpp index 14b984f28b..4b5cf5f0d1 100644 --- a/common/plotters/common_plot_functions.cpp +++ b/common/plotters/common_plot_functions.cpp @@ -126,8 +126,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, SHAPE_LINE_CHAIN& outline = poly->GetPolygons().Outline( idx ); for( int ii = 0; ii < outline.PointCount(); ii++ ) - points.push_back( wxPoint( outline.Point( ii ).x , - outline.Point( ii ).y ) ); + points.emplace_back( outline.Point( ii ).x , + outline.Point( ii ).y ); plotter->PlotPoly( points, FILLED_SHAPE, poly->GetPenWidth() ); } diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index 1f13f33f0c..6e1f3c954f 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -577,10 +577,10 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, std::vector< wxPoint > cornerList; for( int ii = 0; ii < aCornerList.PointCount(); ii++ ) - cornerList.push_back( wxPoint( aCornerList.CPoint( ii ) ) ); + cornerList.emplace_back( aCornerList.CPoint( ii ) ); if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() ) - cornerList.push_back( wxPoint( aCornerList.CPoint( 0 ) ) ); + cornerList.emplace_back( aCornerList.CPoint( 0 ) ); PlotPoly( cornerList , aFill, aWidth, aData ); } diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index 9cc5d1de12..371a5b92a3 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -908,7 +908,7 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w ) for( double t : m_tickValues ) { - m_tickLabels.push_back( TickLabel( t ) ); + m_tickLabels.emplace_back( t ); } updateTickLabels( dc, w ); @@ -1103,7 +1103,7 @@ void mpScaleY::computeSlaveTicks( mpWindow& w ) { m = TransformFromPlot( m_masterScale->TransformToPlot( m_masterScale->m_tickValues[i] ) ); m_tickValues.push_back( m ); - m_tickLabels.push_back( TickLabel( m ) ); + m_tickLabels.emplace_back( m ); m_absVisibleMaxV = std::max( m_absVisibleMaxV, fabs( m ) ); } } @@ -1190,7 +1190,7 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w ) } for( double t : m_tickValues ) - m_tickLabels.push_back( TickLabel( t ) ); + m_tickLabels.emplace_back( t ); // n0 = floor(minVvis / bestStep) * bestStep; @@ -1246,12 +1246,12 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w ) for( d = minDecade; d<=maxDecade; d *= 10.0 ) { // printf("d %.1f\n",d ); - m_tickLabels.push_back( TickLabel( d ) ); + m_tickLabels.emplace_back( d ); for( double dd = d; dd < d * 10; dd += d ) { if( visibleDecades < 2 ) - m_tickLabels.push_back( TickLabel( dd ) ); + m_tickLabels.emplace_back( dd ); m_tickValues.push_back( dd ); } diff --git a/dxflib_qcad/dl_dxf.cpp b/dxflib_qcad/dl_dxf.cpp index a76cf1611f..63e74e58a4 100644 --- a/dxflib_qcad/dl_dxf.cpp +++ b/dxflib_qcad/dl_dxf.cpp @@ -2310,7 +2310,7 @@ void DL_Dxf::addHatch( DL_CreationInterface* creationInterface ) void DL_Dxf::addHatchLoop() { addHatchEdge(); - hatchEdges.push_back( std::vector() ); + hatchEdges.emplace_back( ); } @@ -2384,7 +2384,7 @@ bool DL_Dxf::handleHatchData( DL_CreationInterface* creationInterface ) { case 10: hatchEdge.type = 0; - hatchEdge.vertices.push_back( std::vector() ); + hatchEdge.vertices.emplace_back( ); hatchEdge.vertices.back().push_back( toReal( groupValue ) ); return true; diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 37c5d092c8..896f2031f7 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -397,12 +397,12 @@ void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > msg = MessageTextFromValue( aUnits, m_Width, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); + aList.emplace_back( _( "Line Width" ), msg, BLUE ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); - aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) ); + aList.emplace_back( _( "Bounding Box" ), msg, BROWN ); } diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index ec1460db53..93d1c2532e 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -100,7 +100,7 @@ bool LIB_BEZIER::Inside( EDA_RECT& aRect ) const void LIB_BEZIER::MoveTo( const wxPoint& aPosition ) { if ( !m_PolyPoints.size() ) - m_PolyPoints.push_back( wxPoint(0, 0) ); + m_PolyPoints.emplace_back(0, 0 ); Offset( aPosition - m_PolyPoints[ 0 ] ); } @@ -341,7 +341,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITE msg = MessageTextFromValue( aUnits, m_Width, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); + aList.emplace_back( _( "Line Width" ), msg, BLUE ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, @@ -349,7 +349,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITE bBox.GetEnd().x, bBox.GetEnd().y ); - aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) ); + aList.emplace_back( _( "Bounding Box" ), msg, BROWN ); } wxPoint LIB_BEZIER::GetPosition() const diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index bb78854562..cf565f0cb8 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1426,13 +1426,13 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > + aComponent->GetPosition(); text = MessageTextFromValue( aUnits, pinpos.x, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) ); + aList.emplace_back( _( "Pos X" ), text, DARKMAGENTA ); text = MessageTextFromValue( aUnits, pinpos.y, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) ); + aList.emplace_back( _( "Pos Y" ), text, DARKMAGENTA ); - aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(), - aComponent->GetField( VALUE )->GetShownText(), DARKCYAN ) ); + aList.emplace_back( aComponent->GetField( REFERENCE )->GetShownText(), + aComponent->GetField( VALUE )->GetShownText(), DARKCYAN ); #if defined(DEBUG) diff --git a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp index 93e76a0562..55d0badda4 100644 --- a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp @@ -87,7 +87,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, { if( part->GetFootprints().GetCount() != 0 ) // Put in list { - cmpList.push_back( SCH_REFERENCE( comp, part.get(), sheetList[i] ) ); + cmpList.emplace_back( comp, part.get(), sheetList[i] ); } } diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 06d81ffffd..cf6e18f283 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -72,12 +72,12 @@ vector NGSPICE::GetPlot( const string& aName, int aMaxLen ) if( vi->v_realdata ) { for( int i = 0; i < length; i++ ) - data.push_back( COMPLEX( vi->v_realdata[i], 0.0 ) ); + data.emplace_back( vi->v_realdata[i], 0.0 ); } else if( vi->v_compdata ) { for( int i = 0; i < length; i++ ) - data.push_back( COMPLEX( vi->v_compdata[i].cx_real, vi->v_compdata[i].cx_imag ) ); + data.emplace_back( vi->v_compdata[i].cx_real, vi->v_compdata[i].cx_imag ); } } diff --git a/gerbview/evaluate.cpp b/gerbview/evaluate.cpp index 28d7b3b94c..7f05c7a0b5 100644 --- a/gerbview/evaluate.cpp +++ b/gerbview/evaluate.cpp @@ -141,7 +141,7 @@ double Evaluate( AM_PARAM_EVAL_STACK& aExp ) } else { - optype.push_back( OP_CODE( prm ) ); + optype.emplace_back( prm ); optype.back().m_Priority += extra_priority; } } diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 5ac89a9d58..d5404aeadb 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -779,7 +779,7 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text ) m_LastArcDataType = ARC_INFO_TYPE_NONE; ReadXYCoord( text, true ); // This is the first point (starting point) of routing - m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos ) ); + m_RoutePositions.emplace_back( m_CurrentPos ); break; case DRILL_G_DRILL: @@ -801,7 +801,7 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text ) m_LastArcDataType = ARC_INFO_TYPE_NONE; m_Iterpolation = GERB_INTERPOL_LINEAR_1X; ReadXYCoord( text, true ); - m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos ) ); + m_RoutePositions.emplace_back( m_CurrentPos ); break; case DRILL_G_CWMOVE: @@ -812,9 +812,9 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text ) ReadIJCoord( text ); if( m_LastArcDataType == ARC_INFO_TYPE_CENTER ) - m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_IJPos, ROUTE_CW ) ); + m_RoutePositions.emplace_back( m_CurrentPos, m_IJPos, ROUTE_CW ); else - m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_ArcRadius, ROUTE_CW ) ); + m_RoutePositions.emplace_back( m_CurrentPos, m_ArcRadius, ROUTE_CW ); break; case DRILL_G_CCWMOVE: @@ -825,9 +825,9 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text ) ReadIJCoord( text ); if( m_LastArcDataType == ARC_INFO_TYPE_CENTER ) - m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_IJPos, ROUTE_CCW ) ); + m_RoutePositions.emplace_back( m_CurrentPos, m_IJPos, ROUTE_CCW ); else - m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_ArcRadius, ROUTE_CCW ) ); + m_RoutePositions.emplace_back( m_CurrentPos, m_ArcRadius, ROUTE_CCW ); break; case DRILL_G_ABSOLUTE: diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index cd07b30e40..0d541b7c29 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -660,7 +660,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN wxString text; msg = ShowGBRShape(); - aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Type" ), msg, DARKCYAN ); // Display D_Code value with its attributes for items using a DCode: if( m_Shape == GBR_POLYGON ) // Has no DCode, but can have an attribute @@ -683,32 +683,32 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN text = apertDescr->m_AperFunction; } - aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) ); + aList.emplace_back( msg, text, RED ); // Display graphic layer name msg = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Graphic Layer" ), msg, DARKGREEN ); // Display item rotation // The full rotation is Image rotation + m_lyrRotation // but m_lyrRotation is specific to this object // so we display only this parameter msg.Printf( wxT( "%f" ), m_lyrRotation ); - aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BLUE ) ); + aList.emplace_back( _( "Rotation" ), msg, BLUE ); // Display item polarity (item specific) msg = m_LayerNegative ? _("Clear") : _("Dark"); - aList.push_back( MSG_PANEL_ITEM( _( "Polarity" ), msg, BLUE ) ); + aList.emplace_back( _( "Polarity" ), msg, BLUE ); // Display mirroring (item specific) msg.Printf( wxT( "A:%s B:%s" ), m_mirrorA ? _("Yes") : _("No"), m_mirrorB ? _("Yes") : _("No")); - aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKRED ) ); + aList.emplace_back( _( "Mirror" ), msg, DARKRED ); // Display AB axis swap (item specific) msg = m_swapAxis ? wxT( "A=Y B=X" ) : wxT( "A=X B=Y" ); - aList.push_back( MSG_PANEL_ITEM( _( "AB axis" ), msg, DARKRED ) ); + aList.emplace_back( _( "AB axis" ), msg, DARKRED ); // Display net info, if exists if( m_netAttributes.m_NetAttribType == GBR_NETLIST_METADATA::GBR_NETINFO_UNSPECIFIED ) @@ -748,7 +748,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN cmp_pad_msg << " " << m_netAttributes.m_Cmpref; } - aList.push_back( MSG_PANEL_ITEM( net_msg, cmp_pad_msg, DARKCYAN ) ); + aList.emplace_back( net_msg, cmp_pad_msg, DARKCYAN ); } diff --git a/include/eagle_parser.h b/include/eagle_parser.h index a5520c9954..5b84d4c7bc 100644 --- a/include/eagle_parser.h +++ b/include/eagle_parser.h @@ -116,7 +116,7 @@ class XPATH public: void push( const char* aPathSegment, const char* aAttribute="" ) { - p.push_back( TRIPLET( aPathSegment, aAttribute ) ); + p.emplace_back( aPathSegment, aAttribute ); } void clear() { p.clear(); } diff --git a/include/geometry/poly_grid_partition.h b/include/geometry/poly_grid_partition.h index e08d30ffa9..f23eea6558 100644 --- a/include/geometry/poly_grid_partition.h +++ b/include/geometry/poly_grid_partition.h @@ -164,7 +164,7 @@ enum HASH_FLAG { for( int x = 0; x < gridSize; x++ ) { - m_grid.push_back( EDGE_LIST() ); + m_grid.emplace_back( ); } } diff --git a/include/tool/edit_points.h b/include/tool/edit_points.h index 25cbb1c689..b82def383f 100644 --- a/include/tool/edit_points.h +++ b/include/tool/edit_points.h @@ -390,7 +390,7 @@ public: */ void AddLine( EDIT_POINT& aOrigin, EDIT_POINT& aEnd ) { - m_lines.push_back( EDIT_LINE( aOrigin, aEnd ) ); + m_lines.emplace_back( aOrigin, aEnd ); } /** diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp index 6ec7e4b6fc..5ded1c8c6c 100644 --- a/kicad/project_template.cpp +++ b/kicad/project_template.cpp @@ -86,7 +86,7 @@ std::vector PROJECT_TEMPLATE::GetFileList() // Files that are in the meta directory must not be included if( !p.GetPath().StartsWith( m_metaPath.GetPath() ) ) - files.push_back( allfiles[i] ); + files.emplace_back(allfiles[i] ); } return files; diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index cefe2af6a9..6742f83ea8 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -830,22 +830,22 @@ void BOARD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& } txt.Printf( wxT( "%d" ), GetPadCount() ); - aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Pads" ), txt, DARKGREEN ); txt.Printf( wxT( "%d" ), viasCount ); - aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Vias" ), txt, DARKGREEN ); txt.Printf( wxT( "%d" ), trackSegmentsCount ); - aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN ); txt.Printf( wxT( "%d" ), GetNodesCount() ); - aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) ); + aList.emplace_back( _( "Nodes" ), txt, DARKCYAN ); txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ ); - aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) ); + aList.emplace_back( _( "Nets" ), txt, RED ); txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() ); - aList.push_back( MSG_PANEL_ITEM( _( "Unrouted" ), txt, BLUE ) ); + aList.emplace_back( _( "Unrouted" ), txt, BLUE ); } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index d611e536bc..3eed91cfb3 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -464,47 +464,47 @@ void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT msg = _( "Drawing" ); - aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Type" ), msg, DARKCYAN ); wxString shape = _( "Shape" ); switch( m_Shape ) { case S_CIRCLE: - aList.push_back( MSG_PANEL_ITEM( shape, _( "Circle" ), RED ) ); + aList.emplace_back( shape, _( "Circle" ), RED ); msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) ); + aList.emplace_back( _( "Radius" ), msg, RED ); break; case S_ARC: - aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) ); + aList.emplace_back( shape, _( "Arc" ), RED ); msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 ); - aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, RED ) ); + aList.emplace_back( _( "Angle" ), msg, RED ); msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) ); + aList.emplace_back( _( "Radius" ), msg, RED ); break; case S_CURVE: - aList.push_back( MSG_PANEL_ITEM( shape, _( "Curve" ), RED ) ); + aList.emplace_back( shape, _( "Curve" ), RED ); msg = MessageTextFromValue( aUnits, GetLength() ); - aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Length" ), msg, DARKGREEN ); break; default: { - aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) ); + aList.emplace_back( shape, _( "Segment" ), RED ); msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Length" ), msg, DARKGREEN ); // angle counter-clockwise from 3'o-clock const double deg = RAD2DEG( atan2( (double)( m_Start.y - m_End.y ), (double)( m_End.x - m_Start.x ) ) ); msg.Printf( wxT( "%.1f" ), deg ); - aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Angle" ), msg, DARKGREEN ); } } @@ -515,11 +515,11 @@ void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT MessageTextFromValue( aUnits, GetEnd().x ), MessageTextFromValue( aUnits, GetEnd().y ) ); - aList.push_back( MSG_PANEL_ITEM( start, end, DARKGREEN ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKBROWN ) ); + aList.emplace_back( start, end, DARKGREEN ); + aList.emplace_back( _( "Layer" ), GetLayerName(), DARKBROWN ); msg = MessageTextFromValue( aUnits, m_Width, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Width" ), msg, DARKCYAN ); } @@ -961,7 +961,7 @@ const std::vector DRAWSEGMENT::BuildPolyPointsList() const { for ( auto iter = m_Poly.CIterate(); iter; iter++ ) { - rv.push_back( wxPoint( iter->x, iter->y ) ); + rv.emplace_back( iter->x, iter->y ); } } } diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index a439593b31..8d4aa63a09 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -196,7 +196,7 @@ void EDGE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset for( auto iter = m_Poly.CIterate(); iter; iter++ ) { - points.push_back( wxPoint( iter->x,iter->y ) ); + points.emplace_back( iter->x,iter->y ); } for( unsigned ii = 0; ii < points.size(); ii++ ) @@ -252,7 +252,7 @@ void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT if( !board ) return; - aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) ); + aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN ); // append the features shared with the base class DRAWSEGMENT::GetMsgPanelInfo( aUnits, aList ); diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index fd72ee7b5c..3413f02a93 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -765,41 +765,41 @@ void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& a if( module ) { - aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) ); + aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN ); } - aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) ); + aList.emplace_back( _( "Pad" ), m_name, BROWN ); if( !GetPinFunction().IsEmpty() ) - aList.push_back( MSG_PANEL_ITEM( _( "Pin fct" ), GetPinFunction(), BROWN ) ); + aList.emplace_back( _( "Pin fct" ), GetPinFunction(), BROWN ); - aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) ); + aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ); board = GetBoard(); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), - LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) ); + aList.emplace_back( _( "Layer" ), + LayerMaskDescribe( board, m_layerMask ), DARKGREEN ); - aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) ); + aList.emplace_back( ShowPadShape(), ShowPadAttr(), DARKGREEN ); msg = MessageTextFromValue( aUnits, m_Size.x, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) ); + aList.emplace_back( _( "Width" ), msg, RED ); msg = MessageTextFromValue( aUnits, m_Size.y, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) ); + aList.emplace_back( _( "Height" ), msg, RED ); msg = MessageTextFromValue( aUnits, m_Drill.x, true ); if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) { - aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), msg, RED ) ); + aList.emplace_back( _( "Drill" ), msg, RED ); } else { msg = MessageTextFromValue( aUnits, m_Drill.x, true ) + wxT( "/" ) + MessageTextFromValue( aUnits, m_Drill.y, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), msg, RED ) ); + aList.emplace_back( _( "Drill X / Y" ), msg, RED ); } double module_orient_degrees = module ? module->GetOrientationDegrees() : 0; @@ -811,17 +811,17 @@ void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& a else msg.Printf( wxT( "%3.1f" ), GetOrientationDegrees() ); - aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, LIGHTBLUE ) ); + aList.emplace_back( _( "Angle" ), msg, LIGHTBLUE ); msg = MessageTextFromValue( aUnits, m_Pos.x ) + wxT( ", " ) + MessageTextFromValue( aUnits, m_Pos.y ); - aList.push_back( MSG_PANEL_ITEM( _( "Position" ), msg, LIGHTBLUE ) ); + aList.emplace_back( _( "Position" ), msg, LIGHTBLUE ); if( GetPadToDieLength() ) { msg = MessageTextFromValue( aUnits, GetPadToDieLength(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), msg, CYAN ) ); + aList.emplace_back( _( "Length in package" ), msg, CYAN ); } } diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 533ba73d52..cf4a27eaee 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -89,28 +89,28 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) ); if( m_Parent->Type() == PCB_DIMENSION_T ) - aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), GetShownText(), DARKGREEN ) ); + aList.emplace_back( _( "Dimension" ), GetShownText(), DARKGREEN ); else - aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), GetShownText(), DARKGREEN ) ); + aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BLUE ) ); + aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE ); if( !IsMirrored() ) - aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "No" ), DARKGREEN ) ); + aList.emplace_back( _( "Mirror" ), _( "No" ), DARKGREEN ); else - aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) ); + aList.emplace_back( _( "Mirror" ), _( "Yes" ), DARKGREEN ); msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 ); - aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Angle" ), msg, DARKGREEN ); msg = MessageTextFromValue( aUnits, GetThickness() ); - aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) ); + aList.emplace_back( _( "Thickness" ), msg, MAGENTA ); msg = MessageTextFromValue( aUnits, GetTextWidth() ); - aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) ); + aList.emplace_back( _( "Width" ), msg, RED ); msg = MessageTextFromValue( aUnits, GetTextHeight() ); - aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) ); + aList.emplace_back( _( "Height" ), msg, RED ); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 87939771ad..64baf4c30e 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -350,42 +350,42 @@ void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I }; Line = module->GetReference(); - aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), Line, DARKCYAN ) ); + aList.emplace_back( _( "Footprint" ), Line, DARKCYAN ); Line = GetShownText(); - aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) ); + aList.emplace_back( _( "Text" ), Line, BROWN ); wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS ); - aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) ); + aList.emplace_back( _( "Type" ), text_type_msg[m_Type], DARKGREEN ); if( !IsVisible() ) msg = _( "No" ); else msg = _( "Yes" ); - aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Display" ), msg, DARKGREEN ); // Display text layer - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) ); + aList.emplace_back( _( "Layer" ), GetLayerName(), DARKGREEN ); if( IsMirrored() ) msg = _( "Yes" ); else msg = _( "No" ); - aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Mirror" ), msg, DARKGREEN ); msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() ); - aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Angle" ), msg, DARKGREEN ); msg = MessageTextFromValue( aUnits, GetThickness(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) ); + aList.emplace_back( _( "Thickness" ), msg, DARKGREEN ); msg = MessageTextFromValue( aUnits, GetTextWidth(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) ); + aList.emplace_back( _( "Width" ), msg, RED ); msg = MessageTextFromValue( aUnits, GetTextHeight(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) ); + aList.emplace_back( _( "Height" ), msg, RED ); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 949751bff7..f9866ae131 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -791,15 +791,15 @@ void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& std::tie( count, trackLen, lenPadToDie ) = board->GetTrackLength( *this ); msg = MessageTextFromValue( aUnits, trackLen ); - aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Length" ), msg, DARKCYAN ); if( lenPadToDie != 0 ) { msg = MessageTextFromValue( aUnits, trackLen + lenPadToDie ); - aList.push_back( MSG_PANEL_ITEM( _( "Full Length" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Full Length" ), msg, DARKCYAN ); msg = MessageTextFromValue( aUnits, lenPadToDie, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Pad To Die Length" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Pad To Die Length" ), msg, DARKCYAN ); } } @@ -807,19 +807,19 @@ void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& if( netclass ) { - aList.push_back( MSG_PANEL_ITEM( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ) ); + aList.emplace_back( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ); msg = MessageTextFromValue( aUnits, netclass->GetClearance(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "NC Clearance" ), msg, DARKMAGENTA ) ); + aList.emplace_back( _( "NC Clearance" ), msg, DARKMAGENTA ); msg = MessageTextFromValue( aUnits, netclass->GetTrackWidth(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "NC Width" ), msg, DARKMAGENTA ) ); + aList.emplace_back( _( "NC Width" ), msg, DARKMAGENTA ); msg = MessageTextFromValue( aUnits, netclass->GetViaDiameter(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "NC Via Size" ), msg, DARKMAGENTA ) ); + aList.emplace_back( _( "NC Via Size" ), msg, DARKMAGENTA ); msg = MessageTextFromValue( aUnits, netclass->GetViaDrill(), true ); - aList.push_back( MSG_PANEL_ITEM( _( "NC Via Drill"), msg, DARKMAGENTA ) ); + aList.emplace_back( _( "NC Via Drill"), msg, DARKMAGENTA ); } } @@ -837,18 +837,18 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN else msg = wxT( "" ); - aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); + aList.emplace_back( _( "NetName" ), msg, RED ); // Display net code : (useful in test or debug) msg.Printf( wxT( "%d" ), GetNetCode() ); - aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); + aList.emplace_back( _( "NetCode" ), msg, RED ); } #if defined(DEBUG) // Display the flags msg.Printf( wxT( "0x%08X" ), m_Flags ); - aList.push_back( MSG_PANEL_ITEM( wxT( "Flags" ), msg, BLUE ) ); + aList.emplace_back( wxT( "Flags" ), msg, BLUE ); #if 0 // Display start and end pointers: @@ -880,7 +880,7 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN if( GetState( TRACK_AR ) ) msg[2] = 'A'; - aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) ); + aList.emplace_back( _( "Status" ), msg, MAGENTA ); } void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) @@ -888,7 +888,7 @@ void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM wxString msg; BOARD* board = GetBoard(); - aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Track" ), DARKCYAN ) ); + aList.emplace_back( _( "Type" ), _( "Track" ), DARKCYAN ); GetMsgPanelInfoBase_Common( aUnits, aList ); @@ -898,16 +898,16 @@ void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM else msg.Printf(wxT("%d"), m_Layer ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); + aList.emplace_back( _( "Layer" ), msg, BROWN ); // Display width msg = MessageTextFromValue( aUnits, m_Width, true ); - aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Width" ), msg, DARKCYAN ); // Display segment length msg = ::MessageTextFromValue( aUnits, GetLength() ); - aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Segment Length" ), msg, DARKCYAN ); } void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) @@ -937,7 +937,7 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > break; } - aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Type" ), msg, DARKCYAN ); GetMsgPanelInfoBase_Common( aUnits, aList ); @@ -953,13 +953,13 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > else msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer ); - aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) ); + aList.emplace_back( _( "Layers" ), msg, BROWN ); // Display width msg = MessageTextFromValue( aUnits, m_Width, true ); // Display diameter value: - aList.push_back( MSG_PANEL_ITEM( _( "Diameter" ), msg, DARKCYAN ) ); + aList.emplace_back( _( "Diameter" ), msg, DARKCYAN ); // Display drill value msg = MessageTextFromValue( aUnits, GetDrillValue() ); @@ -991,7 +991,7 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > else title += _( "(NetClass)" ); - aList.push_back( MSG_PANEL_ITEM( title, msg, RED ) ); + aList.emplace_back( title, msg, RED ); } diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index 13ad8381ff..b15d9caed6 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -367,7 +367,7 @@ bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners ) m_currshape.m_Poly.clear(); for( int ii = 0; ii < polyline.PointCount(); ++ii ) - m_currshape.m_Poly.push_back( wxPoint( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y ) ); + m_currshape.m_Poly.emplace_back( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y ); m_warningIcon->Show( true ); m_warningText->Show( true ); @@ -402,7 +402,7 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd( wxCommandEvent& event ) } if( m_currshape.m_Poly.size() == 0 || row >= (int) m_currshape.m_Poly.size() ) - m_currshape.m_Poly.push_back( wxPoint( 0, 0 ) ); + m_currshape.m_Poly.emplace_back( 0, 0 ); else m_currshape.m_Poly.insert( m_currshape.m_Poly.begin() + row, wxPoint( 0, 0 ) ); diff --git a/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp b/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp index d225c28d5b..c003909ab5 100644 --- a/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp +++ b/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp @@ -140,10 +140,10 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataFromWindow() for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ ) { - pluginSettings.push_back( std::make_pair( + pluginSettings.emplace_back( m_grid->GetCellValue( ii, COLUMN_PATH ), m_grid->GetCellValue( ii, COLUMN_VISIBLE ) == wxT("1") ? wxT( "Visible" ) : wxT( "Hidden" ) - ) ); + ); } m_frame->SetActionPluginSettings( pluginSettings ); diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 436a44acb4..215bf722d5 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1155,7 +1155,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) while( vertex ) { if( vertex->GetName() == "vertex" ) - vertices.push_back( EVERTEX( vertex ) ); + vertices.emplace_back( vertex ); vertex = vertex->GetNext(); } @@ -1752,8 +1752,8 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const wxPoint end( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) ); pts.push_back( start ); - pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) ); - pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) ); + pts.emplace_back( kicad_x( r.x2 ), kicad_y( r.y1 ) ); + pts.emplace_back( kicad_x( r.x2 ), kicad_y( r.y2 ) ); pts.push_back( end ); dwg->SetPolyPoints( pts ); @@ -1793,7 +1793,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const while( vertex ) { if( vertex->GetName() == "vertex" ) - vertices.push_back( EVERTEX( vertex ) ); + vertices.emplace_back( vertex ); vertex = vertex->GetNext(); } @@ -1805,7 +1805,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const EVERTEX v1 = vertices[i]; // Append the corner - pts.push_back( wxPoint( kicad_x( v1.x ), kicad_y( v1.y ) ) ); + pts.emplace_back( kicad_x( v1.x ), kicad_y( v1.y ) ); if( v1.curve ) { diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index 7f0b8e5666..e37376728d 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -1118,8 +1118,8 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P SHAPE_LINE_CHAIN poly( polySet.Outline( 0 ) ); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxRealPoint( poly.Point( ii ).x * BOARD_SCALE, - -poly.Point( ii ).y * BOARD_SCALE ) ); + cornerList.emplace_back( poly.Point( ii ).x * BOARD_SCALE, + -poly.Point( ii ).y * BOARD_SCALE ); // Close polygon cornerList.push_back( cornerList[0] ); @@ -1141,8 +1141,8 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P cornerList.clear(); for( int ii = 0; ii < poly.PointCount(); ++ii ) - cornerList.push_back( wxRealPoint( poly.Point( ii ).x * BOARD_SCALE, - -poly.Point( ii ).y * BOARD_SCALE ) ); + cornerList.emplace_back( poly.Point( ii ).x * BOARD_SCALE, + -poly.Point( ii ).y * BOARD_SCALE ); // Close polygon cornerList.push_back( cornerList[0] ); @@ -1722,7 +1722,7 @@ static void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color size_t j = 0; for( size_t i = 0; i < nvert; ++i, j+= 3 ) - vlist.push_back( SGPOINT( vertices[j], vertices[j+1], vertices[j+2] ) ); + vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] ); // create the intermediate scenegraph IFSG_TRANSFORM tx0( PcbOutput.GetRawPtr() ); // tx0 = Transform for this outline @@ -1809,7 +1809,7 @@ static void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color size_t j = 0; for( size_t i = 0; i < nvert; ++i, j+= 3 ) - vlist.push_back( SGPOINT( vertices[j], vertices[j+1], vertices[j+2] ) ); + vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] ); // create the intermediate scenegraph IFSG_TRANSFORM tx0( PcbOutput.GetRawPtr() ); // tx0 = Transform for this outline diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index 3dd054c67c..b060b239c7 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -87,7 +87,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, // append a pair representing the NPTH set of holes, for separate drill files. if( !m_merge_PTH_NPTH ) - hole_sets.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) ); + hole_sets.emplace_back( F_Cu, B_Cu ); for( std::vector::const_iterator it = hole_sets.begin(); it != hole_sets.end(); ++it ) diff --git a/pcbnew/exporters/gendrill_file_writer_base.cpp b/pcbnew/exporters/gendrill_file_writer_base.cpp index 3404d24f24..8225ed7385 100644 --- a/pcbnew/exporters/gendrill_file_writer_base.cpp +++ b/pcbnew/exporters/gendrill_file_writer_base.cpp @@ -226,7 +226,7 @@ std::vector GENDRILL_WRITER_BASE::getUniqueLayerPairs() const std::vector ret; - ret.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) ); // always first in returned list + ret.emplace_back( F_Cu, B_Cu ); // always first in returned list for( std::set< DRILL_LAYER_PAIR >::const_iterator it = unique.begin(); it != unique.end(); ++it ) ret.push_back( *it ); @@ -301,7 +301,7 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory, // append a pair representing the NPTH set of holes, for separate drill files. if( !m_merge_PTH_NPTH ) - hole_sets.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) ); + hole_sets.emplace_back( F_Cu, B_Cu ); for( std::vector::const_iterator it = hole_sets.begin(); it != hole_sets.end(); ++it ) diff --git a/pcbnew/exporters/gendrill_gerber_writer.cpp b/pcbnew/exporters/gendrill_gerber_writer.cpp index 54b73c76a4..5270570560 100644 --- a/pcbnew/exporters/gendrill_gerber_writer.cpp +++ b/pcbnew/exporters/gendrill_gerber_writer.cpp @@ -73,7 +73,7 @@ void GERBER_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, // append a pair representing the NPTH set of holes, for separate drill files. // (Gerber drill files are separate files for PTH and NPTH) - hole_sets.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) ); + hole_sets.emplace_back( F_Cu, B_Cu ); for( std::vector::const_iterator it = hole_sets.begin(); it != hole_sets.end(); ++it ) diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp index 89f3fa6be8..d50259f868 100644 --- a/pcbnew/footprint_info_impl.cpp +++ b/pcbnew/footprint_info_impl.cpp @@ -199,7 +199,7 @@ void FOOTPRINT_LIST_IMPL::StartWorkers( FP_LIB_TABLE* aTable, wxString const* aN for( unsigned i = 0; i < aNThreads; ++i ) { - m_threads.push_back( std::thread( &FOOTPRINT_LIST_IMPL::loader_job, this ) ); + m_threads.emplace_back( &FOOTPRINT_LIST_IMPL::loader_job, this ); } } @@ -252,7 +252,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers() for( size_t ii = 0; ii < std::thread::hardware_concurrency() + 1; ++ii ) { - threads.push_back( std::thread( [this, &queue_parsed]() { + threads.emplace_back( [this, &queue_parsed]() { wxString nickname; while( this->m_queue_out.pop( nickname ) && !m_cancelled ) @@ -293,7 +293,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers() m_count_finished.fetch_add( 1 ); } - } ) ); + } ); } while( !m_cancelled && (size_t)m_count_finished.load() < total_count ) diff --git a/pcbnew/import_gfx/dxf_import_plugin.cpp b/pcbnew/import_gfx/dxf_import_plugin.cpp index bfcc74ceea..1cf93a4c46 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.cpp +++ b/pcbnew/import_gfx/dxf_import_plugin.cpp @@ -195,8 +195,8 @@ void DXF_IMPORT_PLUGIN::addControlPoint( const DL_ControlPointData& aData ) return; // Called for every spline control point, when reading a spline entity - m_curr_entity.m_SplineControlPointList.push_back( SPLINE_CTRL_POINT( aData.x , aData.y, - aData.w ) ); + m_curr_entity.m_SplineControlPointList.emplace_back( aData.x , aData.y, + aData.w ); } @@ -207,7 +207,7 @@ void DXF_IMPORT_PLUGIN::addFitPoint( const DL_FitPointData& aData ) // Called for every spline fit point, when reading a spline entity // we store only the X,Y coord values in a VECTOR2D - m_curr_entity.m_SplineFitPointList.push_back( VECTOR2D( aData.x, aData.y ) ); + m_curr_entity.m_SplineFitPointList.emplace_back( aData.x, aData.y ); } diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 7d17e543c2..19feee3a99 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1008,8 +1008,8 @@ void LEGACY_PLUGIN::loadSETUP() if( data ) // DRILL may not be present ? drill = biuParse( data ); - bds.m_ViasDimensionsList.push_back( VIA_DIMENSION( diameter, - drill ) ); + bds.m_ViasDimensionsList.emplace_back( diameter, + drill ); } else if( TESTLINE( "ViaSize" ) ) @@ -1758,7 +1758,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) BIU x = biuParse( line + SZ( "Dl" ), &data ); BIU y = biuParse( data ); - pts.push_back( wxPoint( x, y ) ); + pts.emplace_back( x, y ); } dwg->SetPolyPoints( pts ); diff --git a/pcbnew/netinfo_item.cpp b/pcbnew/netinfo_item.cpp index 7480b7982f..84066f7481 100644 --- a/pcbnew/netinfo_item.cpp +++ b/pcbnew/netinfo_item.cpp @@ -89,10 +89,10 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I double lengthnet = 0.0; // This is the length of tracks on pcb double lengthPadToDie = 0.0; // this is the length of internal ICs connections - aList.push_back( MSG_PANEL_ITEM( _( "Net Name" ), GetNetname(), RED ) ); + aList.emplace_back( _( "Net Name" ), GetNetname(), RED ); txt.Printf( wxT( "%d" ), GetNet() ); - aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), txt, RED ) ); + aList.emplace_back( _( "Net Code" ), txt, RED ); // Warning: for netcode == NETINFO_LIST::ORPHANED, the parent or the board // can be NULL @@ -115,7 +115,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I } txt.Printf( wxT( "%d" ), count ); - aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Pads" ), txt, DARKGREEN ); count = 0; @@ -135,17 +135,17 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I } txt.Printf( wxT( "%d" ), count ); - aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, BLUE ) ); + aList.emplace_back( _( "Vias" ), txt, BLUE ); // Displays the full net length (tracks on pcb + internal ICs connections ): txt = MessageTextFromValue( aUnits, lengthnet + lengthPadToDie ); - aList.push_back( MSG_PANEL_ITEM( _( "Net Length" ), txt, RED ) ); + aList.emplace_back( _( "Net Length" ), txt, RED ); // Displays the net length of tracks only: txt = MessageTextFromValue( aUnits, lengthnet ); - aList.push_back( MSG_PANEL_ITEM( _( "On Board" ), txt, RED ) ); + aList.emplace_back( _( "On Board" ), txt, RED ); // Displays the net length of internal ICs connections (wires inside ICs): txt = MessageTextFromValue( aUnits, lengthPadToDie, true ); - aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), txt, RED ) ); + aList.emplace_back( _( "In Package" ), txt, RED ); } diff --git a/pcbnew/pad_custom_shape_functions.cpp b/pcbnew/pad_custom_shape_functions.cpp index b99c693523..46b68a337e 100644 --- a/pcbnew/pad_custom_shape_functions.cpp +++ b/pcbnew/pad_custom_shape_functions.cpp @@ -141,7 +141,7 @@ void D_PAD::AddPrimitive( const SHAPE_POLY_SET& aPoly, int aThickness ) poly_no_hole.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); for( auto iter = poly_no_hole.CIterate(); iter; iter++ ) - points.push_back( wxPoint( iter->x, iter->y ) ); + points.emplace_back( iter->x, iter->y ); AddPrimitive( points, aThickness ); } diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 94514532b4..036a1ff913 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -352,22 +352,22 @@ void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vectorGetPadCount() ); - aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Pads" ), txt, DARKGREEN ); txt.Printf( wxT( "%d" ), viasCount ); - aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Vias" ), txt, DARKGREEN ); txt.Printf( wxT( "%d" ), trackSegmentsCount ); - aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) ); + aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN ); txt.Printf( wxT( "%d" ), board->GetNodesCount() ); - aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) ); + aList.emplace_back( _( "Nodes" ), txt, DARKCYAN ); txt.Printf( wxT( "%d" ), board->GetNetCount() - 1 /* don't include "No Net" in count */ ); - aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) ); + aList.emplace_back( _( "Nets" ), txt, RED ); txt.Printf( wxT( "%d" ), board->GetConnectivity()->GetUnconnectedCount() ); - aList.push_back( MSG_PANEL_ITEM( _( "Unrouted" ), txt, BLUE ) ); + aList.emplace_back( _( "Unrouted" ), txt, BLUE ); } diff --git a/pcbnew/pcb_general_settings.cpp b/pcbnew/pcb_general_settings.cpp index 8634f024cc..af3b15d98e 100644 --- a/pcbnew/pcb_general_settings.cpp +++ b/pcbnew/pcb_general_settings.cpp @@ -86,7 +86,7 @@ void PCB_GENERAL_SETTINGS::Load( wxConfigBase* aCfg ) } plugin = pluginTokenizer.GetNextToken(); - m_pluginSettings.push_back( std::make_pair( plugin, pluginTokenizer.GetNextToken() ) ); + m_pluginSettings.emplace_back( plugin, pluginTokenizer.GetNextToken() ); } #endif diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 978e8b6ab5..250747d692 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -232,7 +232,7 @@ public: for( auto n : m_allNodes ) { - anchorChains.push_back( ANCHOR_LIST() ); + anchorChains.emplace_back( ); } for( auto n : m_allNodes ) @@ -310,7 +310,7 @@ public: const auto& prevNode = chain[j - 1]; const auto& curNode = chain[j]; int weight = prevNode->GetCluster() != curNode->GetCluster() ? 1 : 0; - mstEdges.push_back( CN_EDGE ( prevNode, curNode, weight ) ); + mstEdges.emplace_back( prevNode, curNode, weight ); } } diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp index 695ff0364e..00ad05d4e2 100644 --- a/pcbnew/router/pns_diff_pair.cpp +++ b/pcbnew/router/pns_diff_pair.cpp @@ -567,8 +567,8 @@ void DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos ) if( m_fitVias ) BuildGeneric( aCursorPos + dir, aCursorPos - dir, true, true ); else - m_gateways.push_back( DP_GATEWAY( aCursorPos + dir, - aCursorPos - dir, attempt ? true : false ) ); + m_gateways.emplace_back( aCursorPos + dir, + aCursorPos - dir, attempt ? true : false ); } } @@ -671,13 +671,13 @@ void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool if( !aViaMode ) { - m_gateways.push_back( DP_GATEWAY( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ) ); + m_gateways.emplace_back( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ); dir = makeGapVector( p0_n - p0_p, 2 * m_gap ); - m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ) ); - m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ) ); - m_gateways.push_back( DP_GATEWAY( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ) ); - m_gateways.push_back( DP_GATEWAY( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ) ); + m_gateways.emplace_back( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ); + m_gateways.emplace_back( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ); + m_gateways.emplace_back( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ); + m_gateways.emplace_back( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ); } } } @@ -710,7 +710,7 @@ void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool VECTOR2I g_p( ( p0_p - m ).Resize( ceil( (double) m_gap * M_SQRT1_2 ) ) ); VECTOR2I g_n( ( p0_n - m ).Resize( ceil( (double) m_gap * M_SQRT1_2 ) ) ); - m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ) ); + m_gateways.emplace_back( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ); } } } @@ -733,13 +733,13 @@ void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool g_n = ( p0_n - m ).Resize( ceil( (double) m_gap ) ); if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE ) - m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) ); + m_gateways.emplace_back( m + g_p, m + g_n, true ); g_p = ( p0_p - m ).Resize( m_gap ); g_n = ( p0_n - m ).Resize( ceil( (double) m_gap * M_SQRT2 ) ); if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE ) - m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) ); + m_gateways.emplace_back( m + g_p, m + g_n, true ); } } } diff --git a/plugins/3d/idf/s3d_plugin_idf.cpp b/plugins/3d/idf/s3d_plugin_idf.cpp index e45c1f3c45..b0c7bd739a 100644 --- a/plugins/3d/idf/s3d_plugin_idf.cpp +++ b/plugins/3d/idf/s3d_plugin_idf.cpp @@ -484,7 +484,7 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do size_t j = 0; for( size_t i = 0; i < nvert; ++i, j+= 3 ) - vlist.push_back( SGPOINT( vertices[j], vertices[j+1], vertices[j+2] ) ); + vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] ); // create the intermediate scenegraph IFSG_TRANSFORM* tx0 = new IFSG_TRANSFORM( aParent ); // tx0 = Transform for this outline diff --git a/plugins/3d/oce/loadmodel.cpp b/plugins/3d/oce/loadmodel.cpp index c78439d92e..57755e305f 100644 --- a/plugins/3d/oce/loadmodel.cpp +++ b/plugins/3d/oce/loadmodel.cpp @@ -839,7 +839,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent, for(int i = 1; i <= triangulation->NbNodes(); i++) { gp_XYZ v( arrPolyNodes(i).Coord() ); - vertices.push_back( SGPOINT( v.X(), v.Y(), v.Z() ) ); + vertices.emplace_back( v.X(), v.Y(), v.Z() ); } for(int i = 1; i <= triangulation->NbTriangles(); i++) diff --git a/plugins/3d/vrml/v2/vrml2_box.cpp b/plugins/3d/vrml/v2/vrml2_box.cpp index a648e838e9..0948ebe7e7 100644 --- a/plugins/3d/vrml/v2/vrml2_box.cpp +++ b/plugins/3d/vrml/v2/vrml2_box.cpp @@ -302,14 +302,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) std::vector< int > idx; int base = 0; // top - vertices.push_back( SGPOINT( -x, -y, z ) ); - vertices.push_back( SGPOINT( x, -y, z ) ); - vertices.push_back( SGPOINT( x, y, z ) ); - vertices.push_back( SGPOINT( -x, y, z ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) ); + vertices.emplace_back( -x, -y, z ); + vertices.emplace_back( x, -y, z ); + vertices.emplace_back( x, y, z ); + vertices.emplace_back( -x, y, z ); + norms.emplace_back( 0.0, 0.0, 1.0 ); + norms.emplace_back( 0.0, 0.0, 1.0 ); + norms.emplace_back( 0.0, 0.0, 1.0 ); + norms.emplace_back( 0.0, 0.0, 1.0 ); idx.push_back( base ); idx.push_back( base + 1 ); idx.push_back( base + 2 ); @@ -318,14 +318,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) idx.push_back( base + 3 ); base += 4; // bottom - vertices.push_back( SGPOINT( -x, -y, -z ) ); - vertices.push_back( SGPOINT( x, -y, -z ) ); - vertices.push_back( SGPOINT( x, y, -z ) ); - vertices.push_back( SGPOINT( -x, y, -z ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) ); - norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) ); + vertices.emplace_back( -x, -y, -z ); + vertices.emplace_back( x, -y, -z ); + vertices.emplace_back( x, y, -z ); + vertices.emplace_back( -x, y, -z ); + norms.emplace_back( 0.0, 0.0, -1.0 ); + norms.emplace_back( 0.0, 0.0, -1.0 ); + norms.emplace_back( 0.0, 0.0, -1.0 ); + norms.emplace_back( 0.0, 0.0, -1.0 ); idx.push_back( base ); idx.push_back( base + 2 ); idx.push_back( base + 1 ); @@ -334,14 +334,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) idx.push_back( base + 2 ); base += 4; // front - vertices.push_back( SGPOINT( -x, -y, z ) ); - vertices.push_back( SGPOINT( -x, -y, -z ) ); - vertices.push_back( SGPOINT( x, -y, -z ) ); - vertices.push_back( SGPOINT( x, -y, z ) ); - norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) ); - norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) ); - norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) ); - norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) ); + vertices.emplace_back( -x, -y, z ); + vertices.emplace_back( -x, -y, -z ); + vertices.emplace_back( x, -y, -z ); + vertices.emplace_back( x, -y, z ); + norms.emplace_back( 0.0, -1.0, 0.0 ); + norms.emplace_back( 0.0, -1.0, 0.0 ); + norms.emplace_back( 0.0, -1.0, 0.0 ); + norms.emplace_back( 0.0, -1.0, 0.0 ); idx.push_back( base ); idx.push_back( base + 1 ); idx.push_back( base + 2 ); @@ -350,14 +350,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) idx.push_back( base + 3 ); base += 4; // back - vertices.push_back( SGPOINT( -x, y, z ) ); - vertices.push_back( SGPOINT( -x, y, -z ) ); - vertices.push_back( SGPOINT( x, y, -z ) ); - vertices.push_back( SGPOINT( x, y, z ) ); - norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) ); - norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) ); - norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) ); - norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) ); + vertices.emplace_back( -x, y, z ); + vertices.emplace_back( -x, y, -z ); + vertices.emplace_back( x, y, -z ); + vertices.emplace_back( x, y, z ); + norms.emplace_back( 0.0, 1.0, 0.0 ); + norms.emplace_back( 0.0, 1.0, 0.0 ); + norms.emplace_back( 0.0, 1.0, 0.0 ); + norms.emplace_back( 0.0, 1.0, 0.0 ); idx.push_back( base ); idx.push_back( base + 2 ); idx.push_back( base + 1 ); @@ -366,14 +366,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) idx.push_back( base + 2 ); base += 4; // left - vertices.push_back( SGPOINT( -x, -y, -z ) ); - vertices.push_back( SGPOINT( -x, -y, z ) ); - vertices.push_back( SGPOINT( -x, y, z ) ); - vertices.push_back( SGPOINT( -x, y, -z ) ); - norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) ); - norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) ); - norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) ); - norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) ); + vertices.emplace_back( -x, -y, -z ); + vertices.emplace_back( -x, -y, z ); + vertices.emplace_back( -x, y, z ); + vertices.emplace_back( -x, y, -z ); + norms.emplace_back( -1.0, 0.0, 0.0 ); + norms.emplace_back( -1.0, 0.0, 0.0 ); + norms.emplace_back( -1.0, 0.0, 0.0 ); + norms.emplace_back( -1.0, 0.0, 0.0 ); idx.push_back( base ); idx.push_back( base + 1 ); idx.push_back( base + 2 ); @@ -382,14 +382,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) idx.push_back( base + 3 ); base += 4; // right - vertices.push_back( SGPOINT( x, -y, -z ) ); - vertices.push_back( SGPOINT( x, -y, z ) ); - vertices.push_back( SGPOINT( x, y, z ) ); - vertices.push_back( SGPOINT( x, y, -z ) ); - norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) ); - norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) ); - norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) ); - norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) ); + vertices.emplace_back( x, -y, -z ); + vertices.emplace_back( x, -y, z ); + vertices.emplace_back( x, y, z ); + vertices.emplace_back( x, y, -z ); + norms.emplace_back( 1.0, 0.0, 0.0 ); + norms.emplace_back( 1.0, 0.0, 0.0 ); + norms.emplace_back( 1.0, 0.0, 0.0 ); + norms.emplace_back( 1.0, 0.0, 0.0 ); idx.push_back( base ); idx.push_back( base + 2 ); idx.push_back( base + 1 ); diff --git a/plugins/3d/vrml/wrlfacet.cpp b/plugins/3d/vrml/wrlfacet.cpp index 04c408017b..b5cb61aae9 100644 --- a/plugins/3d/vrml/wrlfacet.cpp +++ b/plugins/3d/vrml/wrlfacet.cpp @@ -818,7 +818,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd pt.y = vertices[i].y; pt.z = vertices[i].z; lCPts.push_back( pt ); - lCNorm.push_back( SGVECTOR( normals[i].x, normals[i].y, normals[i].z ) ); + lCNorm.emplace_back( normals[i].x, normals[i].y, normals[i].z ); } vertices.clear(); diff --git a/polygon/clipper.cpp b/polygon/clipper.cpp index 76fa5cfbed..ab7e6e6679 100644 --- a/polygon/clipper.cpp +++ b/polygon/clipper.cpp @@ -5222,7 +5222,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/qa/common/geometry/fixtures_geometry.h b/qa/common/geometry/fixtures_geometry.h index 9bf97f291b..f59cb42f55 100644 --- a/qa/common/geometry/fixtures_geometry.h +++ b/qa/common/geometry/fixtures_geometry.h @@ -58,45 +58,45 @@ struct CommonTestData CommonTestData() { // UniqueVertexPolySet shall have a unique vertex - uniquePoints.push_back( VECTOR2I( 100, 50 ) ); + uniquePoints.emplace_back( 100, 50 ); // Populate the holey polygon set points with 12 points // Square - holeyPoints.push_back( VECTOR2I( 100, 100 ) ); - holeyPoints.push_back( VECTOR2I( 0, 100 ) ); - holeyPoints.push_back( VECTOR2I( 0, 0 ) ); - holeyPoints.push_back( VECTOR2I( 100, 0 ) ); + holeyPoints.emplace_back( 100, 100 ); + holeyPoints.emplace_back( 0, 100 ); + holeyPoints.emplace_back( 0, 0 ); + holeyPoints.emplace_back( 100, 0 ); // Pentagon - holeyPoints.push_back( VECTOR2I( 10, 10 ) ); - holeyPoints.push_back( VECTOR2I( 10, 20 ) ); - holeyPoints.push_back( VECTOR2I( 15, 15 ) ); - holeyPoints.push_back( VECTOR2I( 20, 20 ) ); - holeyPoints.push_back( VECTOR2I( 20, 10 ) ); + holeyPoints.emplace_back( 10, 10 ); + holeyPoints.emplace_back( 10, 20 ); + holeyPoints.emplace_back( 15, 15 ); + holeyPoints.emplace_back( 20, 20 ); + holeyPoints.emplace_back( 20, 10 ); // Triangle - holeyPoints.push_back( VECTOR2I( 40, 10 ) ); - holeyPoints.push_back( VECTOR2I( 40, 20 ) ); - holeyPoints.push_back( VECTOR2I( 60, 10 ) ); + holeyPoints.emplace_back( 40, 10 ); + holeyPoints.emplace_back( 40, 20 ); + holeyPoints.emplace_back( 60, 10 ); // Save the segments of the holeyPolySet. - holeySegments.push_back( SEG( holeyPoints[0], holeyPoints[1] ) ); - holeySegments.push_back( SEG( holeyPoints[1], holeyPoints[2] ) ); - holeySegments.push_back( SEG( holeyPoints[2], holeyPoints[3] ) ); - holeySegments.push_back( SEG( holeyPoints[3], holeyPoints[0] ) ); + holeySegments.emplace_back( holeyPoints[0], holeyPoints[1] ); + holeySegments.emplace_back( holeyPoints[1], holeyPoints[2] ); + holeySegments.emplace_back( holeyPoints[2], holeyPoints[3] ); + holeySegments.emplace_back( holeyPoints[3], holeyPoints[0] ); // Pentagon segments - holeySegments.push_back( SEG( holeyPoints[4], holeyPoints[5] ) ); - holeySegments.push_back( SEG( holeyPoints[5], holeyPoints[6] ) ); - holeySegments.push_back( SEG( holeyPoints[6], holeyPoints[7] ) ); - holeySegments.push_back( SEG( holeyPoints[7], holeyPoints[8] ) ); - holeySegments.push_back( SEG( holeyPoints[8], holeyPoints[4] ) ); + holeySegments.emplace_back( holeyPoints[4], holeyPoints[5] ); + holeySegments.emplace_back( holeyPoints[5], holeyPoints[6] ); + holeySegments.emplace_back( holeyPoints[6], holeyPoints[7] ); + holeySegments.emplace_back( holeyPoints[7], holeyPoints[8] ); + holeySegments.emplace_back( holeyPoints[8], holeyPoints[4] ); // Triangle segments - holeySegments.push_back( SEG( holeyPoints[9], holeyPoints[10] ) ); - holeySegments.push_back( SEG( holeyPoints[10], holeyPoints[11] ) ); - holeySegments.push_back( SEG( holeyPoints[11], holeyPoints[9] ) ); + holeySegments.emplace_back( holeyPoints[9], holeyPoints[10] ); + holeySegments.emplace_back( holeyPoints[10], holeyPoints[11] ); + holeySegments.emplace_back( holeyPoints[11], holeyPoints[9] ); // Auxiliary variables to store the contours that will be added to the polygons SHAPE_LINE_CHAIN polyLine, hole; diff --git a/qa/common/geometry/test_shape_poly_set_collision.cpp b/qa/common/geometry/test_shape_poly_set_collision.cpp index a338328a1c..6fd23e814e 100644 --- a/qa/common/geometry/test_shape_poly_set_collision.cpp +++ b/qa/common/geometry/test_shape_poly_set_collision.cpp @@ -49,24 +49,24 @@ struct CollisionFixture // Create points colliding with the poly set. // Inside the polygon - collidingPoints.push_back( VECTOR2I( 10, 90 ) ); + collidingPoints.emplace_back( 10, 90 ); // Inside the polygon, but on a re-entrant angle of a hole - collidingPoints.push_back( VECTOR2I( 15, 16 ) ); + collidingPoints.emplace_back( 15, 16 ); // On a hole edge => inside the polygon - collidingPoints.push_back( VECTOR2I( 40, 25 ) ); + collidingPoints.emplace_back( 40, 25 ); // Create points not colliding with the poly set. // On the outline edge => outside the polygon - nonCollidingPoints.push_back( VECTOR2I( 0, 10 ) ); + nonCollidingPoints.emplace_back( 0, 10 ); // Completely outside of the polygon - nonCollidingPoints.push_back( VECTOR2I( 200, 200 ) ); + nonCollidingPoints.emplace_back( 200, 200 ); // Inside the outline and inside a hole => outside the polygon - nonCollidingPoints.push_back( VECTOR2I( 15, 12 ) ); + nonCollidingPoints.emplace_back( 15, 12 ); } ~CollisionFixture() diff --git a/qa/common/geometry/test_shape_poly_set_iterator.cpp b/qa/common/geometry/test_shape_poly_set_iterator.cpp index 8b87037025..ef9cc59e09 100644 --- a/qa/common/geometry/test_shape_poly_set_iterator.cpp +++ b/qa/common/geometry/test_shape_poly_set_iterator.cpp @@ -47,9 +47,9 @@ struct IteratorFixture IteratorFixture() { - nullPoints.push_back( VECTOR2I( 100, 100 ) ); - nullPoints.push_back( VECTOR2I( 0, 100 ) ); - nullPoints.push_back( VECTOR2I( 0, 0 ) ); + nullPoints.emplace_back( 100, 100 ); + nullPoints.emplace_back( 0, 100 ); + nullPoints.emplace_back( 0, 0 ); // Create a polygon with its last segment null SHAPE_LINE_CHAIN polyLine; diff --git a/utils/idftools/vrml_layer.cpp b/utils/idftools/vrml_layer.cpp index 064780b342..1520835aa5 100644 --- a/utils/idftools/vrml_layer.cpp +++ b/utils/idftools/vrml_layer.cpp @@ -1388,7 +1388,7 @@ bool VRML_LAYER::addTriplet( VERTEX_3D* p0, VERTEX_3D* p1, VERTEX_3D* p2 ) if( ( dx2 + dy2 ) < err ) return false; - triplets.push_back( TRIPLET_3D( p0->o, p1->o, p2->o ) ); + triplets.emplace_back( p0->o, p1->o, p2->o ); return true; }