Minor speed cleanup

This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
This commit is contained in:
Seth Hillbrand 2019-12-05 07:20:59 -08:00
parent b5f021ff9f
commit c6f5df134c
39 changed files with 89 additions and 85 deletions

View File

@ -49,7 +49,7 @@ void S3D::FormatFloat( std::string& result, double value )
result = out.str();
size_t p = result.find( "." );
size_t p = result.find( '.' );
// trim trailing 0 if appropriate

View File

@ -104,13 +104,13 @@ void WX_HTML_REPORT_PANEL::Flush( bool aSort )
});
}
for( auto line : m_reportHead )
for( const auto& line : m_reportHead )
html += generateHtml( line );
for( auto line : m_report )
for( const auto& line : m_report )
html += generateHtml( line );
for( auto line : m_reportTail )
for( const auto& line : m_reportTail )
html += generateHtml( line );
m_htmlView->SetPage( addHeader( html ) );

View File

@ -618,6 +618,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef() );
const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
cornerList.reserve( path.PointCount() );
for( int jj = 0; jj < path.PointCount(); jj++ )
cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );

View File

@ -962,10 +962,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
// TODO: use Aperture macro and flash it
// polygon corners list
std::vector< wxPoint > cornerList;
for( int ii = 0; ii < 4; ii++ )
cornerList.push_back( aCorners[ii] );
std::vector<wxPoint> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
// Draw the polygon and fill the interior as required
for( unsigned ii = 0; ii < 4; ii++ )

View File

@ -647,6 +647,7 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
// TransformRoundRectToPolygon creates only one convex polygon
std::vector<wxPoint> cornerList;
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
cornerList.reserve( poly.PointCount() );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );

View File

@ -206,6 +206,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
std::vector< wxPoint > cornerList;
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
cornerList.reserve( poly.PointCount() );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );

View File

@ -575,6 +575,7 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
int aWidth, void * aData )
{
std::vector<wxPoint> cornerList;
cornerList.reserve( aCornerList.PointCount() );
for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
cornerList.emplace_back( aCornerList.CPoint( ii ) );

View File

@ -37,7 +37,7 @@ bool compareFileExtensions( const std::string& aExtension,
// Form the regular expression string by placing all possible extensions into it as alternatives
std::string regexString = "(";
bool first = true;
for( auto ext : aReference )
for( const auto& ext : aReference )
{
// The | separate goes between the extensions
if( !first )

View File

@ -398,7 +398,7 @@ void CVPCB_MAINFRAME::UndoAssociation()
m_undoList.pop_back();
// Iterate over the entries to undo
for( auto assoc : curEntry )
for( const auto& assoc : curEntry )
{
AssociateFootprint( assoc, true, false );
redoEntries.emplace_back( assoc.Reverse() );
@ -419,7 +419,7 @@ void CVPCB_MAINFRAME::RedoAssociation()
// Iterate over the entries to undo
bool firstAssoc = true;
for( auto assoc : curEntry )
for( const auto& assoc : curEntry )
{
AssociateFootprint( assoc, firstAssoc );
firstAssoc = false;

View File

@ -209,7 +209,7 @@ bool DIALOG_BUS_MANAGER::TransferDataToWindow()
// clone into a temporary working set
int idx = 0;
for( auto alias : original_aliases )
for( const auto& alias : original_aliases )
{
m_aliases.push_back( alias->Clone() );
auto text = getAliasDisplayText( alias );
@ -249,7 +249,7 @@ bool DIALOG_BUS_MANAGER::TransferDataFromWindow()
std::unordered_set< SCH_SCREEN* > cleared_list;
for( auto alias : m_aliases )
for( const auto& alias : m_aliases )
{
auto screen = alias->GetParent();
@ -348,7 +348,7 @@ void DIALOG_BUS_MANAGER::OnAddBus( wxCommandEvent& aEvent )
return;
}
for( auto alias : m_aliases )
for( const auto& alias : m_aliases )
{
if( alias->GetName() == new_name )
{

View File

@ -148,7 +148,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
}
// Add in any template fieldnames not yet defined:
for( TEMPLATE_FIELDNAME templateFieldname : GetParent()->GetTemplateFieldNames() )
for( const TEMPLATE_FIELDNAME& templateFieldname : GetParent()->GetTemplateFieldNames() )
{
if( defined.count( templateFieldname.m_Name ) <= 0 )
{
@ -456,7 +456,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
{
SCH_FIELD& field = m_fields->at( i );
for( auto fieldname : templateFieldnames )
for( const auto& fieldname : templateFieldnames )
{
if( field.GetName() == fieldname.m_Name && field.GetText().IsEmpty() )
{
@ -664,7 +664,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary( wxCommandEvent
}
// Add in any template fieldnames not yet defined:
for( TEMPLATE_FIELDNAME templateFieldname : GetParent()->GetTemplateFieldNames() )
for( const TEMPLATE_FIELDNAME& templateFieldname : GetParent()->GetTemplateFieldNames() )
{
if( defined.count( templateFieldname.m_Name ) <= 0 )
{

View File

@ -204,7 +204,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
wxArrayString existingLabelArray;
for( wxString label : existingLabels )
for( const wxString& label : existingLabels )
existingLabelArray.push_back( label );
// existingLabelArray.Sort();

View File

@ -296,7 +296,7 @@ int DIALOG_SIM_SETTINGS::ShowModal()
for( auto c : cmbNet )
c.first->Clear();
for( auto net : m_exporter->GetNetIndexMap() )
for( const auto& net : m_exporter->GetNetIndexMap() )
{
for( auto c : cmbNet )
c.first->Append( net.first );
@ -322,7 +322,7 @@ int DIALOG_SIM_SETTINGS::ShowModal()
for( auto c : cmbSrc )
c.first->Clear();
for( auto item : m_exporter->GetSpiceItems() )
for( const auto& item : m_exporter->GetSpiceItems() )
{
if( item.m_primitive == 'V' )
{

View File

@ -267,7 +267,7 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
// Do not modify the existing value, just add missing fields with default values
if( m_useSchFields && m_schfields )
{
for( auto field : *m_schfields )
for( const auto& field : *m_schfields )
{
if( field.GetName() == spiceField && !field.GetText().IsEmpty() )
{
@ -279,7 +279,7 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
else if( m_libfields)
{
// TODO: There must be a good way to template out these repetitive calls
for( auto field : *m_libfields )
for( const auto& field : *m_libfields )
{
if( field.GetName() == spiceField && !field.GetText().IsEmpty() )
{

View File

@ -642,7 +642,7 @@ void PANEL_SYM_LIB_TABLE::populateEnvironReadOnlyTable()
unique.insert( PROJECT_VAR_NAME );
unique.insert( SYMBOL_LIB_TABLE::GlobalPathEnvVariableName() );
for( wxString evName : unique )
for( const wxString& evName : unique )
{
int row = m_path_subs_grid->GetNumberRows();
m_path_subs_grid->AppendRows( 1 );

View File

@ -446,12 +446,12 @@ bool LIB_MANAGER::RevertAll()
if( GetHash() == 0 )
return true;
for( auto lib : m_libs )
for( const auto& lib : m_libs )
{
if( !lib.second.IsModified() )
continue;
for( auto buffer : lib.second.GetBuffers() )
for( const auto& buffer : lib.second.GetBuffers() )
{
if( !buffer->IsModified() )
continue;

View File

@ -266,7 +266,7 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
std::list<wxString> bus_contents( bus_contents_vec.begin(),
bus_contents_vec.end() );
for( auto bus_member : bus_contents )
for( const auto& bus_member : bus_contents )
{
// Nested bus vector inside a bus group
if( conn.IsBusVectorLabel( bus_member ) )
@ -295,7 +295,7 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
else if( auto nested_alias = SCH_SCREEN::GetBusAlias( bus_member ) )
{
// Nested alias inside a group
for( auto alias_member : nested_alias->Members() )
for( const auto& alias_member : nested_alias->Members() )
{
bus_contents.push_back( alias_member );
}

View File

@ -89,7 +89,7 @@ void SCH_CONNECTION::SetDriver( SCH_ITEM* aItem )
{
m_driver = aItem;
for( auto member : m_members )
for( const auto& member : m_members )
member->SetDriver( aItem );
}
@ -98,7 +98,7 @@ void SCH_CONNECTION::SetSheet( SCH_SHEET_PATH aSheet )
{
m_sheet = aSheet;
for( auto member : m_members )
for( const auto& member : m_members )
member->SetSheet( aSheet );
}
@ -289,7 +289,7 @@ void SCH_CONNECTION::SetPrefix( const wxString& aPrefix )
{
m_prefix = aPrefix;
for( auto m : Members() )
for( const auto& m : Members() )
m->SetPrefix( aPrefix );
}
@ -298,7 +298,7 @@ void SCH_CONNECTION::SetSuffix( const wxString& aSuffix )
{
m_suffix = aSuffix;
for( auto m : Members() )
for( const auto& m : Members() )
m->SetSuffix( aSuffix );
}
@ -325,14 +325,14 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
wxString members;
for( auto member : alias->Members() )
for( const auto& member : alias->Members() )
members << member << " ";
aList.push_back( MSG_PANEL_ITEM( msg, members, RED ) );
}
else if( ParseBusGroup( m_name, &group_name, group_members ) )
{
for( auto group_member : group_members )
for( const auto& group_member : group_members )
{
if( auto group_alias = g_ConnectionGraph->GetBusAlias( group_member ) )
{
@ -340,7 +340,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
wxString members;
for( auto member : group_alias->Members() )
for( const auto& member : group_alias->Members() )
members << member << " ";
aList.push_back( MSG_PANEL_ITEM( msg, members, RED ) );
@ -521,10 +521,10 @@ bool SCH_CONNECTION::IsSubsetOf( SCH_CONNECTION* aOther ) const
std::vector<wxString> mine, theirs;
for( auto m : Members() )
for( const auto& m : Members() )
mine.push_back( m->Name( true ) );
for( auto m : aOther->Members() )
for( const auto& m : aOther->Members() )
theirs.push_back( m->Name( true ) );
std::set<wxString> subset;
@ -544,7 +544,7 @@ bool SCH_CONNECTION::IsMemberOfBus( SCH_CONNECTION* aOther ) const
auto me = Name( true );
for( auto m : aOther->Members() )
for( const auto& m : aOther->Members() )
if( m->Name( true ) == me )
return true;

View File

@ -1167,7 +1167,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
component->GetField( REFERENCE )->SetVisible( part->GetField( REFERENCE )->IsVisible() );
component->GetField( VALUE )->SetVisible( part->GetField( VALUE )->IsVisible() );
for( auto a:epart->attribute )
for( const auto& a : epart->attribute )
{
auto field = component->AddField( *component->GetField( VALUE ) );
field->SetName( a.first );
@ -1175,7 +1175,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
field->SetVisible( false );
}
for( auto a:epart->variant )
for( const auto& a : epart->variant )
{
auto field = component->AddField( *component->GetField( VALUE ) );
field->SetName( "VARIANT_" + a.first );
@ -1437,7 +1437,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
if( aDevice->connects.size() != 0 )
{
for( auto connect : aDevice->connects )
for( const auto& connect : aDevice->connects )
{
if( connect.gate == aGateName && pin->GetName() == connect.pin )
{

View File

@ -1846,7 +1846,7 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SCREEN* aScreen )
m_out->Print( 0, "Comment9 %s\n", EscapedUTF8( tb.GetComment( 8 ) ).c_str() );
m_out->Print( 0, "$EndDescr\n" );
for( auto alias : aScreen->GetBusAliases() )
for( const auto& alias : aScreen->GetBusAliases() )
{
saveBusAlias( alias );
}

View File

@ -921,7 +921,7 @@ bool SCH_SCREEN::IsBusAlias( const wxString& aLabel )
SCH_SHEET_LIST aSheets( g_RootSheet );
for( unsigned i = 0; i < aSheets.size(); i++ )
{
for( auto alias : aSheets[i].LastScreen()->GetBusAliases() )
for( const auto& alias : aSheets[i].LastScreen()->GetBusAliases() )
{
if( alias->GetName() == aLabel )
{

View File

@ -476,7 +476,7 @@ bool SIM_PLOT_PANEL::AddTrace( const wxString& aName, int aPoints,
{
bool hasVoltageTraces = false;
for( auto tr : m_traces )
for( const auto& tr : m_traces )
{
if( !( tr.second->GetFlags() & SPT_CURRENT ) )
{

View File

@ -199,7 +199,7 @@ public:
void GetDirtyClusters( CLUSTERS& aClusters )
{
for( auto cl : m_ratsnestClusters )
for( const auto& cl : m_ratsnestClusters )
{
int net = cl->OriginNet();

View File

@ -175,7 +175,7 @@ void CONNECTIVITY_DATA::RecalculateRatsnest( BOARD_COMMIT* aCommit )
}
}
for( auto c : clusters )
for( const auto& c : clusters )
{
int net = c->OriginNet();
@ -208,13 +208,13 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector<BOARD_ITEM*>& aIte
}
}
for( auto item : citems )
for( const auto& item : citems )
{
if ( m_connAlgo->ItemExists( item ) )
{
auto& entry = m_connAlgo->ItemEntry( item );
for( auto cnItem : entry.GetItems() )
for( const auto& cnItem : entry.GetItems() )
{
for( auto anchor : cnItem->Anchors() )
anchor->SetNoLine( true );
@ -592,7 +592,7 @@ void CONNECTIVITY_DATA::GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges) const
{
if( rnNet )
{
for( auto edge : rnNet->GetEdges() )
for( const auto& edge : rnNet->GetEdges() )
{
aEdges.push_back( edge );
}
@ -666,7 +666,7 @@ void CONNECTIVITY_DATA::SetProgressReporter( PROGRESS_REPORTER* aReporter )
const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( MODULE* aComponent, bool aSkipInternalConnections )
{
std::set<int> nets;
std::set<D_PAD*> pads;
std::set<const D_PAD*> pads;
std::vector<CN_EDGE> edges;
for( auto pad : aComponent->Pads() )
@ -675,17 +675,17 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( MODULE* a
pads.insert( pad );
}
for ( auto netcode : nets )
for( const auto& netcode : nets )
{
auto net = GetRatsnestForNet( netcode );
const auto& net = GetRatsnestForNet( netcode );
for ( auto edge : net->GetEdges() )
for( const auto& edge : net->GetEdges() )
{
auto srcNode = edge.GetSourceNode();
auto dstNode = edge.GetTargetNode();
auto srcParent = static_cast<D_PAD*>( srcNode->Parent() );
auto dstParent = static_cast<D_PAD*>( dstNode->Parent() );
auto srcParent = static_cast<const D_PAD*>( srcNode->Parent() );
auto dstParent = static_cast<const D_PAD*>( dstNode->Parent() );
bool srcFound = ( pads.find(srcParent) != pads.end() );
bool dstFound = ( pads.find(dstParent) != pads.end() );

View File

@ -691,13 +691,14 @@ void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& aEvent )
std::vector<wxString> labels{ "", _( "Front Side" ), _( "Back Side" ), _( "Total" ) };
wxString tmp;
for( auto label : labels )
widths.reserve( labels.size() );
for( const auto& label : labels )
widths.push_back( label.size() );
int frontTotal = 0;
int backTotal = 0;
for( auto type : m_componentsTypes )
for( const auto& type : m_componentsTypes )
{
// Get maximum width for left label column
widths[0] = std::max<int>( type.title.size(), widths[0] );

View File

@ -357,7 +357,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
for( MODULE_3D_SETTINGS model : m_footprint->Models() )
for( const MODULE_3D_SETTINGS& model : m_footprint->Models() )
{
m_shapes3D_list.push_back( model );
origPath = model.m_Filename;

View File

@ -285,7 +285,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
for( MODULE_3D_SETTINGS model : m_footprint->Models() )
for( const MODULE_3D_SETTINGS& model : m_footprint->Models() )
{
m_shapes3D_list.push_back( model );
origPath = model.m_Filename;

View File

@ -779,7 +779,7 @@ void PANEL_FP_LIB_TABLE::populateEnvironReadOnlyTable()
// This special environment variable is used to locate 3d shapes
unique.insert( KISYS3DMOD );
for( wxString evName : unique )
for( const wxString& evName : unique )
{
int row = m_path_subs_grid->GetNumberRows();
m_path_subs_grid->AppendRows( 1 );

View File

@ -138,6 +138,7 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataFromWindow()
{
std::vector< std::pair<wxString, wxString> > pluginSettings;
pluginSettings.reserve( m_grid->GetNumberRows() );
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
{
pluginSettings.emplace_back(

View File

@ -1117,6 +1117,7 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P
// TransformRoundChamferedRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN poly( polySet.Outline( 0 ) );
cornerList.reserve( poly.PointCount() );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.emplace_back( poly.Point( ii ).x * BOARD_SCALE,
-poly.Point( ii ).y * BOARD_SCALE );

View File

@ -844,7 +844,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
if( m_isDryRun )
{
for( auto it : m_addedNets )
for( const auto& it : m_addedNets )
delete it.second;
m_addedNets.clear();

View File

@ -230,12 +230,12 @@ public:
CN_ANCHOR_PTR prev, last;
int id = 0;
for( auto n : m_allNodes )
for( const auto& n : m_allNodes )
{
anchorChains.emplace_back( );
}
for( auto n : m_allNodes )
for( const auto& n : m_allNodes )
{
if( !prev || prev->Pos() != n->Pos() )
{
@ -251,7 +251,7 @@ public:
int prevId = 0;
for( auto n : triNodes )
for( const auto& n : triNodes )
{
for( int i = prevId; i < n->Id(); i++ )
anchorChains[prevId].push_back( m_allNodes[ i ] );
@ -284,7 +284,7 @@ public:
triangulator.CreateDelaunay( triNodes.begin(), triNodes.end() );
triangulator.GetEdges( triangEdges );
for( auto e : triangEdges )
for( const auto& e : triangEdges )
{
auto src = m_allNodes[ e->GetSourceNode()->Id() ];
auto dst = m_allNodes[ e->GetTargetNode()->Id() ];
@ -348,7 +348,7 @@ void RN_NET::compute()
else
{
// Set tags to m_nodes as connected
for( auto node : m_nodes )
for( const auto& node : m_nodes )
node->SetTag( 0 );
}
@ -358,7 +358,7 @@ void RN_NET::compute()
m_triangulator->Clear();
for( auto n : m_nodes )
for( const auto& n : m_nodes )
{
m_triangulator->AddNode( n );
}
@ -445,9 +445,9 @@ bool RN_NET::NearestBicoloredPair( const RN_NET& aOtherNet, CN_ANCHOR_PTR& aNode
VECTOR2I::extended_type distMax = VECTOR2I::ECOORD_MAX;
for( auto nodeA : m_nodes )
for( const auto& nodeA : m_nodes )
{
for( auto nodeB : aOtherNet.m_nodes )
for( const auto& nodeB : aOtherNet.m_nodes )
{
if( !nodeA->GetNoLine() )
{

View File

@ -130,7 +130,7 @@ bool LINE_PLACER::handleSelfIntersections()
// if there is more than one intersection, find the one that is
// closest to the beginning of the tail.
for( SHAPE_LINE_CHAIN::INTERSECTION i : ips )
for( const SHAPE_LINE_CHAIN::INTERSECTION& i : ips )
{
if( i.our.Index() < n )
{

View File

@ -347,7 +347,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask,
viaHull.Intersect( hull, isect_list );
for( SHAPE_LINE_CHAIN::INTERSECTION isect : isect_list )
for( const SHAPE_LINE_CHAIN::INTERSECTION& isect : isect_list )
{
int dist = aLine.CLine().Length() +
( isect.p - aLine.Via().Pos() ).EuclideanNorm();
@ -373,7 +373,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask,
hull.Intersect( aLine.CLine(), isect_list );
for( SHAPE_LINE_CHAIN::INTERSECTION isect : isect_list )
for( const SHAPE_LINE_CHAIN::INTERSECTION& isect : isect_list )
{
int dist = aLine.CLine().PathLength( isect.p );

View File

@ -364,7 +364,7 @@ void TOOL_BASE::deleteTraces( ITEM* aStartItem, bool aWholeTrack )
TOPOLOGY topo( node );
ITEM_SET path = topo.AssembleTrivialPath( aStartItem );
for( auto ent : path.Items() )
for( const auto& ent : path.Items() )
node->Remove( ent.item );
}

View File

@ -251,7 +251,7 @@ const ITEM_SET TOPOLOGY::AssembleTrivialPath( ITEM* aStart )
if( !jt->IsNonFanoutVia() )
return ITEM_SET();
for( auto entry : jt->Links().Items() )
for( const auto& entry : jt->Links().Items() )
if( ( seg = dyn_cast<SEGMENT*>( entry.item ) ) )
break;
}

View File

@ -89,7 +89,7 @@ int main( int argc, char **argv )
line.clear();
std::getline( cin, line );
if( line.find( "\"" ) != string::npos )
if( line.find( '\"' ) != string::npos )
{
cerr << "[INFO] geometry name may not contain quotation marks\n";
line.clear();
@ -104,7 +104,7 @@ int main( int argc, char **argv )
line.clear();
std::getline( cin, line );
if( line.find( "\"" ) != string::npos )
if( line.find( '\"' ) != string::npos )
{
cerr << "[INFO] part name may not contain quotation marks\n";
line.clear();

View File

@ -862,7 +862,7 @@ wxString S3D_RESOLVER::expandVars( const wxString& aPath )
wxString result;
for( auto i: m_EnvVars )
for( const auto& i : m_EnvVars )
{
if( !aPath.compare( 2, i.first.length(), i.first ) )
{

View File

@ -806,7 +806,7 @@ bool PCBMODEL::CreatePCB()
}
// subtract cutouts (if any)
for( auto i : m_cutouts )
for( const auto& i : m_cutouts )
board = BRepAlgoAPI_Cut( board, i );
// push the board to the data structure
@ -995,7 +995,7 @@ bool PCBMODEL::getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_L
//TODO - Other alternative formats?
for( auto alt : alts )
for( const auto& alt : alts )
{
wxFileName altFile( basePath, baseName + "." + alt );