Don't copy items in for loops when not needed

This commit is contained in:
Ian McInerney 2022-09-24 03:17:32 +01:00
parent f37086e840
commit fdb97a46c1
8 changed files with 10 additions and 10 deletions

View File

@ -365,17 +365,17 @@ int DIALOG_SIM_SETTINGS::ShowModal()
{ m_noiseRef, m_noiseRef->GetStringSelection() }
};
for( auto c : cmbNet )
for( auto& c : cmbNet )
c.first->Clear();
for( const auto& net : m_circuitModel->GetNets() )
{
for( auto c : cmbNet )
for( auto& c : cmbNet )
c.first->Append( net );
}
// Try to restore the previous selection, if possible
for( auto c : cmbNet )
for( auto& c : cmbNet )
{
int idx = c.first->FindString( c.second );

View File

@ -638,7 +638,7 @@ void SIM_PLOT_PANEL::ResetScales()
if( m_axis_y2 )
m_axis_y2->ResetDataRange();
for( auto t : m_traces )
for( auto& t : m_traces )
t.second->UpdateScales();
}

View File

@ -1256,7 +1256,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aPar
void SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetRootSymbolNames( wxArrayString& aRootSymbolNames )
{
for( auto entry : m_symbols )
for( auto& entry : m_symbols )
{
if( entry->GetSymbol()->IsAlias() )
continue;

View File

@ -437,7 +437,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
std::vector<std::string> gerberExts( GerberFileExtensions );
gerberExts.push_back( DrillFileExtension );
for( auto fileName : m_AcceptedFiles )
for( const wxFileName& fileName : m_AcceptedFiles )
{
if( IsExtensionAccepted( fileName.GetExt(), gerberExts ) )
{

View File

@ -97,7 +97,7 @@ VVIA* DRAGGER::checkVirtualVia( const VECTOR2D& aP, SEGMENT* aSeg )
return nullptr;
}
for( auto lnk : jt->LinkList() )
for( auto& lnk : jt->LinkList() )
{
if( lnk.item->IsVirtual() && lnk.item->OfKind( ITEM::VIA_T ))
{

View File

@ -565,7 +565,7 @@ void ROUTER_TOOL::saveRouterDebugLog()
const auto& events = logger->GetEvents();
for( auto evt : events)
for( const auto& evt : events)
{
fprintf( f, "event %d %d %d %s\n", evt.p.x, evt.p.y, evt.type,
static_cast<const char*>( evt.uuid.AsString().c_str() ) );

View File

@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE( ComparePinNumbers )
};
for( auto el : cases )
for( auto& el : cases )
{
int retval = PIN_NUMBERS::Compare( el.m_lhs, el.m_rhs );
wxString msg;

View File

@ -37,7 +37,7 @@ static bool pluginHandlesExt( const GRAPHICS_IMPORT_PLUGIN& aPlugin, const std::
{
const auto exts = aPlugin.GetFileExtensions();
for( auto ext : exts )
for( const auto& ext : exts )
{
std::regex ext_reg( ext );