On 2019-08-30 15:49, Sylwester Kocjan wrote:
m_schfields->erase( std::remove_if(
m_schfields->begin(), m_schfields->end(),
[&]( const SCH_FIELD& f ) { return f.GetName()
== spiceField; } ), m_schfields->end() );
My question is, why deletion is repeated: at first there is called
remove_if(), and later erase(), which will delete
all the fields behind the removed one. From my point of view it looks
like remove_if() only should be enough.
remove_if() re-orders the container and returns the iterator that points
to the first matching element. erase() removes all elements from this
iterator through the end of the container.
See https://en.wikipedia.org/wiki/Erase%E2%80%93remove_idiom
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp