Use range-based loop to iterate over vector

This commit is contained in:
Artur Wieczorek 2022-10-26 11:26:40 +02:00
parent 29bdf9fa4c
commit 99cc2eb17d
3 changed files with 9 additions and 13 deletions

View file

@ -412,10 +412,9 @@ public:
virtual ~wxPGHeaderCtrl()
{
for (wxVector<wxHeaderColumnSimple*>::const_iterator it = m_columns.begin();
it != m_columns.end(); ++it)
for ( wxHeaderColumnSimple* c : m_columns )
{
delete *it;
delete c;
}
}

View file

@ -509,9 +509,8 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
//
// Convert invalid cells to default ones in this grid
for (wxVector<wxPGCell>::iterator it = m_cells.begin(); it != m_cells.end(); ++it)
for ( wxPGCell& cell : m_cells )
{
wxPGCell& cell = *it;
if ( cell.IsInvalid() )
{
cell = IsCategory() ? propgrid->GetCategoryDefaultCell()
@ -643,9 +642,8 @@ void wxPGProperty::OnDetached(wxPropertyGridPageState* WXUNUSED(state),
const wxPGCell& catDefCell = propgrid->GetCategoryDefaultCell();
// Make default cells invalid
for(wxVector<wxPGCell>::iterator it = m_cells.begin(); it != m_cells.end(); ++it)
for ( wxPGCell& cell : m_cells )
{
wxPGCell& cell = *it;
if ( cell.IsSameAs(propDefCell) ||
cell.IsSameAs(catDefCell) )
{

View file

@ -485,9 +485,8 @@ wxPropertyGrid::~wxPropertyGrid()
//
// Remove grid and property pointers from live wxPropertyGridEvents.
for (wxVector<wxPropertyGridEvent*>::iterator it = m_liveEvents.begin(); it != m_liveEvents.end(); ++it)
for ( wxPropertyGridEvent* evt : m_liveEvents )
{
wxPropertyGridEvent* evt = *it;
evt->SetPropertyGrid(nullptr);
evt->SetProperty(nullptr);
}
@ -560,9 +559,9 @@ wxPropertyGrid::~wxPropertyGrid()
delete m_pState;
// Delete common value records
for(wxVector<wxPGCommonValue*>::iterator it = m_commonValues.begin(); it != m_commonValues.end(); ++it)
for ( wxPGCommonValue* v : m_commonValues )
{
delete *it;
delete v;
}
#if WXWIN_COMPATIBILITY_3_0
wxASSERT( gs_deletedEditorObjects[this]->empty() );
@ -2158,9 +2157,9 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
wxVector<int> splitterPos;
splitterPos.reserve(colCount);
int sx = x;
for (wxVector<int>::const_iterator cit = colWidths.begin(); cit != colWidths.end(); ++cit)
for ( int cw : colWidths )
{
sx += *cit;
sx += cw;
splitterPos.push_back(sx);
}