diff --git a/3d-viewer/3d_cache/3d_cache.cpp b/3d-viewer/3d_cache/3d_cache.cpp index cc77ac2c02..5f471c37b1 100644 --- a/3d-viewer/3d_cache/3d_cache.cpp +++ b/3d-viewer/3d_cache/3d_cache.cpp @@ -304,8 +304,7 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY** // or we do not have a configured cache file directory, we create an // entry to prevent further attempts at loading the file - if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* > - ( aFileName, ep ) ).second == false ) + if( m_CacheMap.emplace( aFileName, ep ).second == false ) { wxLogTrace( MASK_3D_CACHE, wxT( "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'" ), @@ -323,8 +322,7 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY** return nullptr; } - if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* > - ( aFileName, ep ) ).second == false ) + if( m_CacheMap.emplace( aFileName, ep ).second == false ) { wxLogTrace( MASK_3D_CACHE, wxT( "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'" ), diff --git a/3d-viewer/3d_cache/3d_plugin_manager.cpp b/3d-viewer/3d_cache/3d_plugin_manager.cpp index f2d2bbaa03..705b1426d8 100644 --- a/3d-viewer/3d_cache/3d_plugin_manager.cpp +++ b/3d-viewer/3d_cache/3d_plugin_manager.cpp @@ -55,7 +55,7 @@ S3D_PLUGIN_MANAGER::S3D_PLUGIN_MANAGER() { // create the initial file filter list entry - m_FileFilters.push_back( _( "All Files" ) + wxT( " (*.*)|*.*" ) ); + m_FileFilters.emplace_back( _( "All Files" ) + wxT( " (*.*)|*.*" ) ); // discover and load plugins loadPlugins(); @@ -391,7 +391,7 @@ void S3D_PLUGIN_MANAGER::addExtensionMap( KICAD_PLUGIN_LDR_3D* aPlugin ) if( !ws.empty() ) { - m_ExtMap.insert( std::pair< const wxString, KICAD_PLUGIN_LDR_3D* >( ws, aPlugin ) ); + m_ExtMap.emplace( ws, aPlugin ); } } diff --git a/3d-viewer/3d_cache/sg/ifsg_api.cpp b/3d-viewer/3d_cache/sg/ifsg_api.cpp index 5f20782ab5..9c343cf9a3 100644 --- a/3d-viewer/3d_cache/sg/ifsg_api.cpp +++ b/3d-viewer/3d_cache/sg/ifsg_api.cpp @@ -359,7 +359,7 @@ S3DMODEL* S3D::GetModel( SCENEGRAPH* aNode ) app.transparency = 0.0f; materials.matorder.push_back( &app ); - materials.matmap.insert( std::pair< SGAPPEARANCE const*, int >( &app, 0 ) ); + materials.matmap.emplace( &app, 0 ); if( aNode->Prepare( nullptr, materials, meshes ) ) { diff --git a/3d-viewer/3d_cache/sg/sg_helpers.cpp b/3d-viewer/3d_cache/sg/sg_helpers.cpp index 6fe234755f..0a3fe5e580 100644 --- a/3d-viewer/3d_cache/sg/sg_helpers.cpp +++ b/3d-viewer/3d_cache/sg/sg_helpers.cpp @@ -420,8 +420,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords, std::vector< int > } else { - vmap.insert( std::pair < int, std::list < glm::dvec3 > > - ( p1, std::list < glm::dvec3 >( 1, tri ) ) ); + vmap.emplace( p1, std::list < glm::dvec3 >( 1, tri ) ); } ip = vmap.find( p2 ); @@ -432,8 +431,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords, std::vector< int > } else { - vmap.insert( std::pair < int, std::list < glm::dvec3 > > - ( p2, std::list < glm::dvec3 >( 1, tri ) ) ); + vmap.emplace( p2, std::list < glm::dvec3 >( 1, tri ) ); } ip = vmap.find( p3 ); @@ -444,8 +442,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords, std::vector< int > } else { - vmap.insert( std::pair < int, std::list < glm::dvec3 > > - ( p3, std::list < glm::dvec3 >( 1, tri ) ) ); + vmap.emplace( p3, std::list < glm::dvec3 >( 1, tri ) ); } } diff --git a/3d-viewer/3d_cache/sg/sg_node.cpp b/3d-viewer/3d_cache/sg/sg_node.cpp index 06e2f9a8e1..6fdc9a6ac1 100644 --- a/3d-viewer/3d_cache/sg/sg_node.cpp +++ b/3d-viewer/3d_cache/sg/sg_node.cpp @@ -260,7 +260,7 @@ bool S3D::GetMatIndex( MATLIST& aList, SGNODE* aNode, int& aIndex ) int idx = (int)aList.matorder.size(); aList.matorder.push_back( node ); - aList.matmap.insert( std::pair< SGAPPEARANCE const*, int >( node, idx ) ); + aList.matmap.emplace( node, idx ); aIndex = idx; return true; diff --git a/3d-viewer/3d_cache/sg/sg_shape.cpp b/3d-viewer/3d_cache/sg/sg_shape.cpp index cdc13d96f0..3955971aac 100644 --- a/3d-viewer/3d_cache/sg/sg_shape.cpp +++ b/3d-viewer/3d_cache/sg/sg_shape.cpp @@ -699,7 +699,7 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform, S3D::MATLIST& materials, if( mit == indexmap.end() ) { - indexmap.insert( std::pair< int, unsigned int >( lv[i], vertices.size() ) ); + indexmap.emplace( lv[i], vertices.size() ); vertices.push_back( lv[i] ); } } diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index ebcaa9f777..fe2a37634e 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -136,7 +136,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() : if( !g_ColorsLoaded ) { #define ADD_COLOR( list, r, g, b, a, name ) \ - list.push_back( CUSTOM_COLOR_ITEM( r/255.0, g/255.0, b/255.0, a, name ) ) + list.emplace_back( r/255.0, g/255.0, b/255.0, a, name ) ADD_COLOR( g_SilkscreenColors, 245, 245, 245, 1.0, NotSpecifiedPrm() ); // White ADD_COLOR( g_SilkscreenColors, 20, 51, 36, 1.0, wxT( "Green" ) ); diff --git a/common/font/fontconfig.cpp b/common/font/fontconfig.cpp index bfd6c36a3e..9f5ee5a6a0 100644 --- a/common/font/fontconfig.cpp +++ b/common/font/fontconfig.cpp @@ -200,7 +200,7 @@ void FONTCONFIG::ListFonts( std::vector& aFonts ) std::map::iterator it = m_fonts.find( theFamily ); if( it == m_fonts.end() ) - m_fonts.insert( std::pair( theFamily, fontInfo ) ); + m_fonts.emplace( theFamily, fontInfo ); else it->second.Children().push_back( fontInfo ); } diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 5a7e757558..3548356029 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -488,7 +488,7 @@ std::string FormatProbeItems( bool aSelectConnections, const std::dequeGetField( REFERENCE_FIELD )->GetText(); - parts.insert( wxT( "F" ) + EscapeString( ref, CTX_IPC ) ); + parts.emplace( wxT( "F" ) + EscapeString( ref, CTX_IPC ) ); break; } @@ -515,7 +515,7 @@ std::string FormatProbeItems( bool aSelectConnections, const std::dequem_Uuid.AsString(); - parts.insert( wxT( "S" ) + full_path ); + parts.emplace( wxT( "S" ) + full_path ); break; } diff --git a/gerbview/am_param.cpp b/gerbview/am_param.cpp index a92235eb5c..be9c2f34c3 100644 --- a/gerbview/am_param.cpp +++ b/gerbview/am_param.cpp @@ -100,7 +100,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const case OPEN_PAR: case CLOSE_PAR: // Priority modifiers: store in stack op_code = item.GetType(); - ops.push_back( AM_PARAM_EVAL( op_code ) ); + ops.emplace_back( op_code ); break; case PUSHPARM: @@ -122,12 +122,12 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const wxFAIL_MSG( wxT( "AM_PARAM::GetValue(): NULL param aDcode" ) ); } - ops.push_back( AM_PARAM_EVAL( curr_value ) ); + ops.emplace_back( curr_value ); break; case PUSHVALUE: // a value is on the stack: curr_value = item.GetValue(); - ops.push_back( AM_PARAM_EVAL( curr_value ) ); + ops.emplace_back( curr_value ); break; default: diff --git a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp index a9eab4ff39..afbbaee26a 100644 --- a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp +++ b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp @@ -397,9 +397,9 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& if( aDeltaX > size.y ) // shrinking turned the trapezoid into a triangle { corners.reserve( 3 ); - corners.push_back( ROUNDED_CORNER( -size.x, -size.y - aDeltaX ) ); - corners.push_back( ROUNDED_CORNER( KiROUND( size.y / slope ), 0 ) ); - corners.push_back( ROUNDED_CORNER( -size.x, size.y + aDeltaX ) ); + corners.emplace_back( -size.x, -size.y - aDeltaX ); + corners.emplace_back( KiROUND( size.y / slope ), 0 ); + corners.emplace_back( -size.x, size.y + aDeltaX ); } } else // vertical trapezoid @@ -413,9 +413,9 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& if( aDeltaY > size.x ) { corners.reserve( 3 ); - corners.push_back( ROUNDED_CORNER( 0, -KiROUND( size.x / slope ) ) ); - corners.push_back( ROUNDED_CORNER( size.x + aDeltaY, size.y ) ); - corners.push_back( ROUNDED_CORNER( -size.x - aDeltaY, size.y ) ); + corners.emplace_back( 0, -KiROUND( size.x / slope ) ); + corners.emplace_back( size.x + aDeltaY, size.y ); + corners.emplace_back( -size.x - aDeltaY, size.y ); } } @@ -425,10 +425,10 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& if( corners.empty() ) { corners.reserve( 4 ); - corners.push_back( ROUNDED_CORNER( -size.x + aDeltaY, -size.y - aDeltaX ) ); - corners.push_back( ROUNDED_CORNER( size.x - aDeltaY, -size.y + aDeltaX ) ); - corners.push_back( ROUNDED_CORNER( size.x + aDeltaY, size.y - aDeltaX ) ); - corners.push_back( ROUNDED_CORNER( -size.x - aDeltaY, size.y + aDeltaX ) ); + corners.emplace_back( -size.x + aDeltaY, -size.y - aDeltaX ); + corners.emplace_back( size.x - aDeltaY, -size.y + aDeltaX ); + corners.emplace_back( size.x + aDeltaY, size.y - aDeltaX ); + corners.emplace_back( -size.x - aDeltaY, size.y + aDeltaX ); if( aDeltaY == size.x || aDeltaX == size.y ) CornerListRemoveDuplicates( corners ); @@ -466,10 +466,10 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const std::vector corners; corners.reserve( 4 + chamferCnt ); - corners.push_back( ROUNDED_CORNER( -size.x, -size.y, aCornerRadius ) ); - corners.push_back( ROUNDED_CORNER( size.x, -size.y, aCornerRadius ) ); - corners.push_back( ROUNDED_CORNER( size.x, size.y, aCornerRadius ) ); - corners.push_back( ROUNDED_CORNER( -size.x, size.y, aCornerRadius ) ); + corners.emplace_back( -size.x, -size.y, aCornerRadius ); + corners.emplace_back( size.x, -size.y, aCornerRadius ); + corners.emplace_back( size.x, size.y, aCornerRadius ); + corners.emplace_back( -size.x, size.y, aCornerRadius ); if( aChamferCorners ) { diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index 4ec6b165e7..c0692b8cd1 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -116,7 +116,7 @@ ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper( bool aRequiredOrientation, size_t z_value_ptr = aZValueBuffer.size(); aZValueBuffer.push_back( z_value ); - c_path.push_back( ClipperLib::IntPoint( vertex.x, vertex.y, z_value_ptr ) ); + c_path.emplace_back( vertex.x, vertex.y, z_value_ptr ); } aArcBuffer.insert( aArcBuffer.end(), input.m_arcs.begin(), input.m_arcs.end() ); diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 8100699b01..cf7deb97bc 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -815,8 +815,8 @@ void CONNECTIVITY_DATA::SetProgressReporter( PROGRESS_REPORTER* aReporter ) void CONNECTIVITY_DATA::AddExclusion( const KIID& aBoardItemId1, const KIID& aBoardItemId2 ) { - m_exclusions.insert( std::pair( aBoardItemId1, aBoardItemId2 ) ); - m_exclusions.insert( std::pair( aBoardItemId2, aBoardItemId1 ) ); + m_exclusions.emplace( aBoardItemId1, aBoardItemId2 ); + m_exclusions.emplace( aBoardItemId2, aBoardItemId1 ); for( RN_NET* rnNet : m_nets ) { diff --git a/pcbnew/netlist_reader/pcb_netlist.h b/pcbnew/netlist_reader/pcb_netlist.h index 56627f8518..2c3acdef7b 100644 --- a/pcbnew/netlist_reader/pcb_netlist.h +++ b/pcbnew/netlist_reader/pcb_netlist.h @@ -103,7 +103,7 @@ public: void AddNet( const wxString& aPinName, const wxString& aNetName, const wxString& aPinFunction, const wxString& aPinType ) { - m_nets.push_back( COMPONENT_NET( aPinName, aNetName, aPinFunction, aPinType ) ); + m_nets.emplace_back( aPinName, aNetName, aPinFunction, aPinType ); } unsigned GetNetCount() const { return m_nets.size(); } diff --git a/plugins/3d/oce/loadmodel.cpp b/plugins/3d/oce/loadmodel.cpp index 642b333845..aeda9a10dd 100644 --- a/plugins/3d/oce/loadmodel.cpp +++ b/plugins/3d/oce/loadmodel.cpp @@ -259,7 +259,7 @@ struct DATA app.SetSpecular( 0.12f, 0.12f, 0.12f ); app.SetAmbient( 0.1f, 0.1f, 0.1f ); app.SetDiffuse( colorObj->Red(), colorObj->Green(), colorObj->Blue() ); - colors.insert( std::pair< Standard_Real, SGNODE* >( id, app.GetRawPtr() ) ); + colors.emplace( id, app.GetRawPtr() ); return app.GetRawPtr(); } @@ -1167,7 +1167,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent, vshape.SetParent( parent ); if( !partID.empty() ) - data.faces.insert( std::pair< std::string, SGNODE* >( partID, vshape.GetRawPtr() ) ); + data.faces.emplace( partID, vshape.GetRawPtr() ); // The outer surface of an IGES model is indeterminate so // we must render both sides of a surface. @@ -1187,7 +1187,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent, vshape2.SetParent( parent ); if( !partID.empty() ) - data.faces.insert( std::pair< std::string, SGNODE* >( id2, vshape2.GetRawPtr() ) ); + data.faces.emplace( id2, vshape2.GetRawPtr() ); } return true; diff --git a/plugins/3d/vrml/v1/vrml1_node.cpp b/plugins/3d/vrml/v1/vrml1_node.cpp index fba5e1d7f2..fbf734c05a 100644 --- a/plugins/3d/vrml/v1/vrml1_node.cpp +++ b/plugins/3d/vrml/v1/vrml1_node.cpp @@ -46,7 +46,7 @@ bool NAMEREGISTER::AddName( const std::string& aName, WRL1NODE* aNode ) if( ir != reg.end() ) reg.erase( ir ); - reg.insert( std::pair< std::string, WRL1NODE* >( aName, aNode ) ); + reg.emplace( aName, aNode ); return true; } diff --git a/plugins/3d/vrml/v2/vrml2_base.cpp b/plugins/3d/vrml/v2/vrml2_base.cpp index 0c2b380b49..622e26e6b7 100644 --- a/plugins/3d/vrml/v2/vrml2_base.cpp +++ b/plugins/3d/vrml/v2/vrml2_base.cpp @@ -130,7 +130,7 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName ) if( !fn.Normalize() ) { - m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, nullptr ) ); + m_inlineModels.emplace( aName, nullptr ); return nullptr; } @@ -138,11 +138,11 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName ) if( nullptr == sp ) { - m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, nullptr ) ); + m_inlineModels.emplace( aName, nullptr ); return nullptr; } - m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, (SGNODE*)sp ) ); + m_inlineModels.emplace( aName, (SGNODE*) sp ); return (SGNODE*)sp; } diff --git a/plugins/3d/vrml/x3d/x3d_base.cpp b/plugins/3d/vrml/x3d/x3d_base.cpp index 8dcd555f70..b2a2372598 100644 --- a/plugins/3d/vrml/x3d/x3d_base.cpp +++ b/plugins/3d/vrml/x3d/x3d_base.cpp @@ -42,7 +42,7 @@ bool X3D_DICT::AddName( const wxString& aName, X3DNODE* aNode ) if( ir != reg.end() ) reg.erase( ir ); - reg.insert( std::pair< wxString, X3DNODE* >( aName, aNode ) ); + reg.emplace( aName, aNode ); return true; } diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp index e03cc19ccd..969fb5ceb8 100644 --- a/utils/idftools/idf_parser.cpp +++ b/utils/idftools/idf_parser.cpp @@ -2026,8 +2026,7 @@ void IDF3_BOARD::readBrdSection( std::istream& aBoardFile, IDF3::FILE_STATE& aBo } } - if( olnOther.insert( pair(op->GetOutlineIdentifier(), op ) ).second == false ) + if( olnOther.emplace( op->GetOutlineIdentifier(), op ).second == false ) { ostringstream ostr; ostr << "invalid IDF file\n"; @@ -2277,7 +2276,7 @@ void IDF3_BOARD::readBrdSection( std::istream& aBoardFile, IDF3::FILE_STATE& aBo } } - olnGroup.insert( pair(op->GetGroupName(), op) ); + olnGroup.emplace( op->GetGroupName(), op ); return; } @@ -2551,8 +2550,7 @@ void IDF3_BOARD::readLibSection( std::istream& aLibFile, IDF3::FILE_STATE& aLibS if( cop == nullptr ) { - compOutlines.insert( pair( pout->GetUID(), pout ) ); + compOutlines.emplace( pout->GetUID(), pout ); } else { @@ -3751,8 +3749,7 @@ IDF_DRILL_DATA* IDF3_BOARD::addCompDrill( double aDia, double aXpos, double aYpo comp->SetParent( this ); comp->SetRefDes( refdes ); - ref = components.insert( std::pair< std::string, - IDF3_COMPONENT*> ( comp->GetRefDes(), comp ) ).first; + ref = components.emplace( comp->GetRefDes(), comp ).first; } // add the drill @@ -3812,8 +3809,7 @@ IDF_DRILL_DATA* IDF3_BOARD::addCompDrill( IDF_DRILL_DATA* aDrilledHole ) comp->SetParent( this ); comp->SetRefDes( aDrilledHole->GetDrillRefDes() ); - ref = components.insert( std::pair< std::string, - IDF3_COMPONENT*> ( comp->GetRefDes(), comp ) ).first; + ref = components.emplace( comp->GetRefDes(), comp ).first; } IDF_DRILL_DATA* dp = ref->second->AddDrill( aDrilledHole ); @@ -3859,8 +3855,7 @@ bool IDF3_BOARD::AddComponent( IDF3_COMPONENT* aComponent ) return false; } - if( components.insert( std::pair - ( aComponent->GetRefDes(), aComponent ) ).second == false ) + if( components.emplace( aComponent->GetRefDes(), aComponent ).second == false ) { ostringstream ostr; ostr << __FILE__ << ":" << __LINE__ << ":" << __FUNCTION__ << "(): \n"; @@ -4086,7 +4081,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( const wxString& aFullFileNam delete cp; // make sure we can find the item via its filename - uidFileList.insert( std::pair< std::string, std::string>( fname, uid ) ); + uidFileList.emplace( fname, uid ); // return the pointer to the original return oldp; @@ -4114,8 +4109,8 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( const wxString& aFullFileNam if( oldp == nullptr ) { // everything is fine, there are no existing entries - uidFileList.insert( std::pair< std::string, std::string>( fname, uid ) ); - compOutlines.insert( pair( uid, cp ) ); + uidFileList.emplace( fname, uid ); + compOutlines.emplace( uid, cp ); return cp; } @@ -4126,7 +4121,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( const wxString& aFullFileNam delete cp; // make sure we can find the item via its other filename - uidFileList.insert( std::pair< std::string, std::string>( fname, uid ) ); + uidFileList.emplace( fname, uid ); // return the pointer to the original return oldp; @@ -4212,7 +4207,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetInvalidOutline( const std::string& aGeomName, else cp->CreateDefaultOutline( aGeomName, aPartName ); - compOutlines.insert( pair(cp->GetUID(), cp) ); + compOutlines.emplace( cp->GetUID(), cp ); return cp; }