Browse Source

Remove all instances from a collector when requested

Perhaps COLLECTOR should use a set, but going for the
less invasive change for now.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5934
6.0.7
Jon Evans 5 years ago
parent
commit
74e86a289d
  1. 14
      include/collector.h

14
include/collector.h

@ -143,14 +143,12 @@ public:
*/
void Remove( const EDA_ITEM* aItem )
{
for( size_t i = 0; i < m_list.size(); i++ )
{
if( m_list[i] == aItem )
{
m_list.erase( m_list.begin() + i);
return;
}
}
m_list.erase( std::remove_if( m_list.begin(), m_list.end(),
[&aItem]( const EDA_ITEM* aCandidate )
{
return aCandidate == aItem;
} ),
m_list.end() );
}
/**

Loading…
Cancel
Save