Replace alg::delete and alg::delete_if with std c++20

This commit is contained in:
Seth Hillbrand 2025-08-04 09:03:16 -07:00
parent 06d5503db1
commit 4aa2047f45
26 changed files with 71 additions and 64 deletions

View File

@ -43,6 +43,7 @@
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <../3d_rendering/opengl/render_3d_opengl.h> #include <../3d_rendering/opengl/render_3d_opengl.h>
#include <algorithm>
/// Render Row abbreviation to reduce source width. /// Render Row abbreviation to reduce source width.
#define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D #define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D
@ -872,7 +873,7 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
if( m_cbLayerPresets->FindString( name ) != wxNOT_FOUND ) if( m_cbLayerPresets->FindString( name ) != wxNOT_FOUND )
m_cbLayerPresets->Delete( m_cbLayerPresets->FindString( name ) ); m_cbLayerPresets->Delete( m_cbLayerPresets->FindString( name ) );
alg::delete_if( cfg->m_LayerPresets, std::erase_if( cfg->m_LayerPresets,
[name]( const LAYER_PRESET_3D& preset ) [name]( const LAYER_PRESET_3D& preset )
{ {
return preset.name == name; return preset.name == name;

View File

@ -24,6 +24,7 @@
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
#include <json_common.h> #include <json_common.h>
#include <algorithm>
#include <database/database_lib_settings.h> #include <database/database_lib_settings.h>
#include <settings/parameters.h> #include <settings/parameters.h>
@ -91,7 +92,7 @@ DATABASE_LIB_SETTINGS::DATABASE_LIB_SETTINGS( const std::string& aFilename ) :
// Sanitize library display names; currently only `/` is removed because we // Sanitize library display names; currently only `/` is removed because we
// use it as a separator and allow it in symbol names. // use it as a separator and allow it in symbol names.
alg::delete_matching( table.name, '/' ); std::erase( table.name, '/' );
if( entry.contains( "properties" ) && entry["properties"].is_object() ) if( entry.contains( "properties" ) && entry["properties"].is_object() )
{ {

View File

@ -38,6 +38,8 @@
#include <notifications_manager.h> #include <notifications_manager.h>
#include <widgets/kistatusbar.h> #include <widgets/kistatusbar.h>
#include <widgets/ui_common.h> #include <widgets/ui_common.h>
#include <algorithm>
#include <json_common.h> #include <json_common.h>
#include <kiplatform/ui.h> #include <kiplatform/ui.h>
@ -377,7 +379,7 @@ void NOTIFICATIONS_MANAGER::onListWindowClosed( wxCloseEvent& aEvent )
{ {
NOTIFICATIONS_LIST* evtWindow = dynamic_cast<NOTIFICATIONS_LIST*>( aEvent.GetEventObject() ); NOTIFICATIONS_LIST* evtWindow = dynamic_cast<NOTIFICATIONS_LIST*>( aEvent.GetEventObject() );
alg::delete_if( m_shownDialogs, [&]( NOTIFICATIONS_LIST* dialog ) std::erase_if( m_shownDialogs, [&]( NOTIFICATIONS_LIST* dialog )
{ {
return dialog == evtWindow; return dialog == evtWindow;
} ); } );
@ -426,7 +428,7 @@ void NOTIFICATIONS_MANAGER::RegisterStatusBar( KISTATUSBAR* aStatusBar )
void NOTIFICATIONS_MANAGER::UnregisterStatusBar( KISTATUSBAR* aStatusBar ) void NOTIFICATIONS_MANAGER::UnregisterStatusBar( KISTATUSBAR* aStatusBar )
{ {
alg::delete_if( m_statusBars, [&]( KISTATUSBAR* statusBar ) std::erase_if( m_statusBars, [&]( KISTATUSBAR* statusBar )
{ {
return statusBar == aStatusBar; return statusBar == aStatusBar;
} ); } );

View File

@ -25,6 +25,7 @@
#include <wx/stdpaths.h> // required on Mac #include <wx/stdpaths.h> // required on Mac
#include <kiplatform/environment.h> #include <kiplatform/environment.h>
#include <algorithm>
#include <pgm_base.h> #include <pgm_base.h>
#include <confirm.h> #include <confirm.h>
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
@ -249,10 +250,10 @@ void PROJECT::UnpinLibrary( const wxString& aLibrary, enum LIB_TYPE_T aLibType )
return; return;
} }
alg::delete_matching( *pinnedLibsFile, aLibrary ); std::erase( *pinnedLibsFile, aLibrary );
Pgm().GetSettingsManager().SaveProject(); Pgm().GetSettingsManager().SaveProject();
alg::delete_matching( *pinnedLibsCfg, aLibrary ); std::erase( *pinnedLibsCfg, aLibrary );
cfg->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( cfg ) ); cfg->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( cfg ) );
} }

View File

@ -38,6 +38,8 @@
#include <macros.h> #include <macros.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <paths.h> #include <paths.h>
#include <algorithm>
#include <project.h> #include <project.h>
#include <project/project_archiver.h> #include <project/project_archiver.h>
#include <project/project_file.h> #include <project/project_file.h>
@ -745,7 +747,7 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector<wxString>* aPaths )
} }
} }
alg::delete_if( *aPaths, []( const wxString& aPath ) -> bool std::erase_if( *aPaths, []( const wxString& aPath ) -> bool
{ {
wxFileName fulldir = wxFileName::DirName( aPath ); wxFileName fulldir = wxFileName::DirName( aPath );
const wxArrayString& dirs = fulldir.GetDirs(); const wxArrayString& dirs = fulldir.GetDirs();

View File

@ -38,6 +38,7 @@
#include <gal/definitions.h> #include <gal/definitions.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <gal/painter.h> #include <gal/painter.h>
#include <algorithm>
#include <core/profile.h> #include <core/profile.h>
@ -369,7 +370,7 @@ void VIEW::Remove( VIEW_ITEM* aItem )
if( s_gcCounter > 4096 ) if( s_gcCounter > 4096 )
{ {
// Perform defragmentation // Perform defragmentation
alg::delete_if( *m_allItems, std::erase_if( *m_allItems,
[]( VIEW_ITEM* it ) []( VIEW_ITEM* it )
{ {
return it == nullptr; return it == nullptr;

View File

@ -33,6 +33,7 @@
#include <set> #include <set>
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
#include <algorithm>
#include <view/view_group.h> #include <view/view_group.h>
#include <view/view.h> #include <view/view.h>
#include <view/view_item.h> #include <view/view_item.h>
@ -69,7 +70,7 @@ void VIEW_GROUP::Add( VIEW_ITEM* aItem )
void VIEW_GROUP::Remove( VIEW_ITEM* aItem ) void VIEW_GROUP::Remove( VIEW_ITEM* aItem )
{ {
alg::delete_matching( m_groupItems, aItem ); std::erase( m_groupItems, aItem );
} }

View File

@ -25,6 +25,7 @@
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <widgets/bitmap_button.h> #include <widgets/bitmap_button.h>
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
#include <algorithm>
#include <macros.h> #include <macros.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <dialogs/eda_reorderable_list_dialog.h> #include <dialogs/eda_reorderable_list_dialog.h>
@ -430,7 +431,7 @@ void LIB_TREE::updateRecentSearchMenu()
if( !newEntry.IsEmpty() ) if( !newEntry.IsEmpty() )
{ {
if( alg::contains( recents, newEntry ) ) if( alg::contains( recents, newEntry ) )
alg::delete_matching( recents, newEntry ); std::erase( recents, newEntry );
if( recents.size() >= RECENT_SEARCHES_MAX ) if( recents.size() >= RECENT_SEARCHES_MAX )
recents.pop_back(); recents.pop_back();

View File

@ -959,7 +959,7 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
} }
} }
alg::delete_matching( m_items, aItem ); std::erase( m_items, aItem );
}; };
for( SCH_ITEM* item : aItems ) for( SCH_ITEM* item : aItems )
@ -987,7 +987,7 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
removeSubgraphs( subgraphs ); removeSubgraphs( subgraphs );
for( const auto& [path, item] : retvals ) for( const auto& [path, item] : retvals )
alg::delete_matching( m_items, item ); std::erase( m_items, item );
return retvals; return retvals;
} }
@ -1006,7 +1006,7 @@ void CONNECTION_GRAPH::RemoveItem( SCH_ITEM* aItem )
subgraph = subgraph->m_absorbed_by; subgraph = subgraph->m_absorbed_by;
subgraph->RemoveItem( aItem ); subgraph->RemoveItem( aItem );
alg::delete_matching( m_items, aItem ); std::erase( m_items, aItem );
m_item_to_subgraph_map.erase( it ); m_item_to_subgraph_map.erase( it );
} }
@ -1892,7 +1892,7 @@ void CONNECTION_GRAPH::processSubGraphs()
wxS( "%ld (%s) is weakly driven and not unique. Changing to %s." ), wxS( "%ld (%s) is weakly driven and not unique. Changing to %s." ),
subgraph->m_code, name, new_name ); subgraph->m_code, name, new_name );
alg::delete_matching( *vec, subgraph ); std::erase( *vec, subgraph );
m_net_name_to_subgraphs_map[new_name].emplace_back( subgraph ); m_net_name_to_subgraphs_map[new_name].emplace_back( subgraph );
@ -2216,7 +2216,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
proc_sub_graph.Show(); proc_sub_graph.Show();
// Absorbed subgraphs should no longer be considered // Absorbed subgraphs should no longer be considered
alg::delete_if( m_driver_subgraphs, [&]( const CONNECTION_SUBGRAPH* candidate ) -> bool std::erase_if( m_driver_subgraphs, [&]( const CONNECTION_SUBGRAPH* candidate ) -> bool
{ {
return candidate->m_absorbed; return candidate->m_absorbed;
} ); } );
@ -3083,7 +3083,7 @@ void CONNECTION_GRAPH::recacheSubgraphName( CONNECTION_SUBGRAPH* aSubgraph,
if( it != m_net_name_to_subgraphs_map.end() ) if( it != m_net_name_to_subgraphs_map.end() )
{ {
std::vector<CONNECTION_SUBGRAPH*>& vec = it->second; std::vector<CONNECTION_SUBGRAPH*>& vec = it->second;
alg::delete_matching( vec, aSubgraph ); std::erase( vec, aSubgraph );
} }
wxLogTrace( ConnTrace, wxS( "recacheSubgraphName: %s => %s" ), aOldName, wxLogTrace( ConnTrace, wxS( "recacheSubgraphName: %s => %s" ), aOldName,

View File

@ -38,6 +38,7 @@
#include <sch_screen.h> #include <sch_screen.h>
#include <sch_textbox.h> #include <sch_textbox.h>
#include <string_utils.h> #include <string_utils.h>
#include <algorithm>
#include <ki_exception.h> #include <ki_exception.h>
#include <dialogs/html_message_box.h> #include <dialogs/html_message_box.h>
@ -709,7 +710,7 @@ SCH_SHEET_LIST NETLIST_EXPORTER_SPICE::BuildSheetList( unsigned aNetlistOptions
else else
sheets = m_schematic->Hierarchy(); sheets = m_schematic->Hierarchy();
alg::delete_if( sheets, std::erase_if( sheets,
[&]( const SCH_SHEET_PATH& sheet ) [&]( const SCH_SHEET_PATH& sheet )
{ {
return sheet.GetExcludedFromSim(); return sheet.GetExcludedFromSim();

View File

@ -27,7 +27,6 @@
#include <symbol_library.h> #include <symbol_library.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <core/kicad_algo.h>
#include <symbol_library_common.h> #include <symbol_library_common.h>
#include <confirm.h> #include <confirm.h>
#include <sch_tool_utils.h> #include <sch_tool_utils.h>
@ -38,6 +37,7 @@
#include <symbol_viewer_frame.h> #include <symbol_viewer_frame.h>
#include <symbol_tree_model_adapter.h> #include <symbol_tree_model_adapter.h>
#include <symbol_editor/symbol_editor_settings.h> #include <symbol_editor/symbol_editor_settings.h>
#include <algorithm>
#include <sch_symbol.h> #include <sch_symbol.h>
#include <sch_commit.h> #include <sch_commit.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
@ -82,7 +82,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibrary( const SYMBOL_LIBRARY_FILTER
if( sel.LibId.IsValid() ) if( sel.LibId.IsValid() )
{ {
alg::delete_if( aHistoryList, [&sel]( PICKED_SYMBOL const& i ) std::erase_if( aHistoryList, [&sel]( PICKED_SYMBOL const& i )
{ {
return i.LibId == sel.LibId; return i.LibId == sel.LibId;
} ); } );

View File

@ -33,6 +33,7 @@
#include <general.h> #include <general.h>
#include <string_utils.h> #include <string_utils.h>
#include "scintilla_tricks.h" #include "scintilla_tricks.h"
#include <algorithm>
class SCH_EDIT_FRAME; class SCH_EDIT_FRAME;
class SCH_TEXT; class SCH_TEXT;
@ -424,7 +425,7 @@ inline void SetFieldValue( std::vector<SCH_FIELD>& aFields, const wxString& aFie
{ {
if( aValue == "" ) if( aValue == "" )
{ {
alg::delete_if( aFields, [&]( const SCH_FIELD& field ) std::erase_if( aFields, [&]( const SCH_FIELD& field )
{ {
return field.GetName() == aFieldName; return field.GetName() == aFieldName;
} ); } );

View File

@ -34,6 +34,7 @@
#include <schematic.h> #include <schematic.h>
#include <project.h> #include <project.h>
#include <richio.h> #include <richio.h>
#include <algorithm>
void LTSPICE_SCHEMATIC::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSheet, void LTSPICE_SCHEMATIC::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSheet,
@ -81,7 +82,7 @@ void LTSPICE_SCHEMATIC::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSheet,
std::vector<LTSPICE_FILE> newSubSchematicElements = GetSchematicElements( buffer ); std::vector<LTSPICE_FILE> newSubSchematicElements = GetSchematicElements( buffer );
alg::delete_if( newSubSchematicElements, std::erase_if( newSubSchematicElements,
[&mapOfAscFiles]( const LTSPICE_FILE& ii ) [&mapOfAscFiles]( const LTSPICE_FILE& ii )
{ {
return mapOfAscFiles[ii.ElementName].IsEmpty(); return mapOfAscFiles[ii.ElementName].IsEmpty();

View File

@ -43,6 +43,7 @@
#include <project/net_settings.h> #include <project/net_settings.h>
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
#include <core/mirror.h> #include <core/mirror.h>
#include <algorithm>
#include <trigo.h> #include <trigo.h>
#include <sch_label.h> #include <sch_label.h>
#include <sch_rule_area.h> #include <sch_rule_area.h>
@ -667,7 +668,7 @@ void SCH_LABEL_BASE::GetIntersheetRefs( const SCH_SHEET_PATH* aPath,
if( !Schematic()->Settings().m_IntersheetRefsListOwnPage ) if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
{ {
int currentPage = Schematic()->CurrentSheet().GetVirtualPageNumber(); int currentPage = Schematic()->CurrentSheet().GetVirtualPageNumber();
alg::delete_matching( pageListCopy, currentPage ); std::erase( pageListCopy, currentPage );
if( pageListCopy.empty() ) if( pageListCopy.empty() )
return; return;
@ -1983,7 +1984,7 @@ bool SCH_GLOBALLABEL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* tok
if( !settings.m_IntersheetRefsListOwnPage ) if( !settings.m_IntersheetRefsListOwnPage )
{ {
int currentPage = schematic->CurrentSheet().GetVirtualPageNumber(); int currentPage = schematic->CurrentSheet().GetVirtualPageNumber();
alg::delete_matching( pageListCopy, currentPage ); std::erase( pageListCopy, currentPage );
} }
std::map<int, wxString> sheetPages = schematic->GetVirtualPageToSheetPagesMap(); std::map<int, wxString> sheetPages = schematic->GetVirtualPageToSheetPagesMap();

View File

@ -27,6 +27,7 @@
#include <sch_tablecell.h> #include <sch_tablecell.h>
#include <sch_item.h> #include <sch_item.h>
#include <algorithm>
class SCH_TABLE : public SCH_ITEM class SCH_TABLE : public SCH_ITEM
@ -180,7 +181,7 @@ public:
void DeleteMarkedCells() void DeleteMarkedCells()
{ {
alg::delete_if( m_cells, std::erase_if( m_cells,
[]( SCH_TABLECELL* cell ) []( SCH_TABLECELL* cell )
{ {
return ( cell->GetFlags() & STRUCT_DELETED ) > 0; return ( cell->GetFlags() & STRUCT_DELETED ) > 0;

View File

@ -28,6 +28,7 @@
#include <eeschema_settings.h> #include <eeschema_settings.h>
#include <widgets/panel_symbol_chooser.h> #include <widgets/panel_symbol_chooser.h>
#include <symbol_chooser_frame.h> #include <symbol_chooser_frame.h>
#include <algorithm>
static std::vector<PICKED_SYMBOL> s_SymbolHistoryList; static std::vector<PICKED_SYMBOL> s_SymbolHistoryList;
@ -36,7 +37,7 @@ static unsigned s_SymbolHistoryMaxCount = 8;
static void AddSymbolToHistory( const PICKED_SYMBOL& aSymbol ) static void AddSymbolToHistory( const PICKED_SYMBOL& aSymbol )
{ {
// Remove duplicates // Remove duplicates
alg::delete_if( s_SymbolHistoryList, std::erase_if( s_SymbolHistoryList,
[&]( const PICKED_SYMBOL& candidate ) -> bool [&]( const PICKED_SYMBOL& candidate ) -> bool
{ {
return candidate.LibId == aSymbol.LibId return candidate.LibId == aSymbol.LibId

View File

@ -34,6 +34,7 @@
#include <sch_actions.h> #include <sch_actions.h>
#include <sch_tool_utils.h> #include <sch_tool_utils.h>
#include <increment.h> #include <increment.h>
#include <algorithm>
#include <string_utils.h> #include <string_utils.h>
#include <sch_bitmap.h> #include <sch_bitmap.h>
#include <sch_bus_entry.h> #include <sch_bus_entry.h>
@ -2799,7 +2800,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
// A SCH_GLOBALLABEL has a specific field for intersheet references that has // A SCH_GLOBALLABEL has a specific field for intersheet references that has
// no meaning for other labels // no meaning for other labels
alg::delete_if( new_label->GetFields(), std::erase_if( new_label->GetFields(),
[&]( SCH_FIELD& field ) [&]( SCH_FIELD& field )
{ {
return field.GetId() == FIELD_T::INTERSHEET_REFS return field.GetId() == FIELD_T::INTERSHEET_REFS

View File

@ -38,6 +38,7 @@
#include <symbol_editor_settings.h> #include <symbol_editor_settings.h>
#include <symbol_library.h> // For SYMBOL_LIBRARY_FILTER #include <symbol_library.h> // For SYMBOL_LIBRARY_FILTER
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <algorithm>
#include <wx/button.h> #include <wx/button.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
#include <wx/panel.h> #include <wx/panel.h>
@ -667,7 +668,7 @@ void PANEL_SYMBOL_CHOOSER::onFootprintSelected( wxCommandEvent& aEvent )
{ {
m_fp_override = aEvent.GetString(); m_fp_override = aEvent.GetString();
alg::delete_if( m_field_edits, []( std::pair<FIELD_T, wxString> const& i ) std::erase_if( m_field_edits, []( std::pair<FIELD_T, wxString> const& i )
{ {
return i.first == FIELD_T::FOOTPRINT; return i.first == FIELD_T::FOOTPRINT;
} ); } );

View File

@ -27,6 +27,7 @@
#include <vector> #include <vector>
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
#include <algorithm>
#include <eda_item.h> // SEARCH_RESULT #include <eda_item.h> // SEARCH_RESULT
@ -119,7 +120,7 @@ public:
*/ */
void Remove( const EDA_ITEM* aItem ) void Remove( const EDA_ITEM* aItem )
{ {
alg::delete_if( m_list, [&aItem]( const EDA_ITEM* aCandidate ) std::erase_if( m_list, [&aItem]( const EDA_ITEM* aCandidate )
{ {
return aCandidate == aItem; return aCandidate == aItem;
} ); } );

View File

@ -154,28 +154,6 @@ bool within_wrapped_range( T __val, T __minval, T __maxval, T __wrap )
return __val >= __minval || __val <= __maxval; return __val >= __minval || __val <= __maxval;
} }
/**
* Covers for the horrifically named std::remove and std::remove_if (neither of which remove
* anything).
*/
/**
* @brief Deletes all values from \a __c which match \a __value.
*/
template <class _Container, typename _Value>
void delete_matching( _Container& __c, _Value __value )
{
__c.erase( std::remove( __c.begin(), __c.end(), __value ), __c.end() );
}
/**
* @brief Deletes all values from \a __c for which \a __f returns true.
*/
template <class _Container, class _Function>
void delete_if( _Container& __c, _Function&& __f )
{
__c.erase( std::remove_if( __c.begin(), __c.end(), std::forward<_Function>( __f ) ), __c.end() );
}
/** /**
* @brief Deletes all duplicate values from \a __c. * @brief Deletes all duplicate values from \a __c.
*/ */

View File

@ -26,6 +26,7 @@
*/ */
#include <iterator> #include <iterator>
#include <algorithm>
#include <wx/log.h> #include <wx/log.h>
@ -1323,24 +1324,24 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
} }
case PCB_MARKER_T: case PCB_MARKER_T:
alg::delete_matching( m_markers, aBoardItem ); std::erase( m_markers, aBoardItem );
break; break;
case PCB_GROUP_T: case PCB_GROUP_T:
alg::delete_matching( m_groups, aBoardItem ); std::erase( m_groups, aBoardItem );
break; break;
case PCB_ZONE_T: case PCB_ZONE_T:
alg::delete_matching( m_zones, aBoardItem ); std::erase( m_zones, aBoardItem );
break; break;
case PCB_GENERATOR_T: case PCB_GENERATOR_T:
alg::delete_matching( m_generators, aBoardItem ); std::erase( m_generators, aBoardItem );
break; break;
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
{ {
alg::delete_matching( m_footprints, aBoardItem ); std::erase( m_footprints, aBoardItem );
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aBoardItem ); FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aBoardItem );
footprint->RunOnChildren( [&]( BOARD_ITEM* aChild ) footprint->RunOnChildren( [&]( BOARD_ITEM* aChild )
@ -1355,7 +1356,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_ARC_T: case PCB_ARC_T:
case PCB_VIA_T: case PCB_VIA_T:
alg::delete_matching( m_tracks, aBoardItem ); std::erase( m_tracks, aBoardItem );
break; break;
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
@ -1371,7 +1372,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
case PCB_TABLE_T: case PCB_TABLE_T:
case PCB_TARGET_T: case PCB_TARGET_T:
{ {
alg::delete_matching( m_drawings, aBoardItem ); std::erase( m_drawings, aBoardItem );
if( aBoardItem->Type() == PCB_TABLE_T ) if( aBoardItem->Type() == PCB_TABLE_T )
{ {

View File

@ -223,13 +223,13 @@ FABMASTER::section_type FABMASTER::detectType( size_t aOffset )
/// We strip the underscores from all column names as some export variants use them and /// We strip the underscores from all column names as some export variants use them and
// some do not // some do not
alg::delete_if( row1, []( char c ){ return c == '_'; } ); std::erase_if( row1, []( char c ){ return c == '_'; } );
alg::delete_if( row2, []( char c ){ return c == '_'; } ); std::erase_if( row2, []( char c ){ return c == '_'; } );
if( row.size() > 3 ) if( row.size() > 3 )
{ {
row3 = row[3]; row3 = row[3];
alg::delete_if( row3, []( char c ){ return c == '_'; } ); std::erase_if( row3, []( char c ){ return c == '_'; } );
} }
if( row1 == "REFDES" && row2 == "COMPCLASS" ) if( row1 == "REFDES" && row2 == "COMPCLASS" )
@ -325,7 +325,7 @@ int FABMASTER::getColFromName( size_t aRow, const std::string& aStr )
{ {
/// Some Fabmaster headers include the underscores while others do not /// Some Fabmaster headers include the underscores while others do not
/// so we strip them uniformly before comparing /// so we strip them uniformly before comparing
alg::delete_if( header[i], []( const char c ) { return c == '_'; } ); std::erase_if( header[i], []( const char c ) { return c == '_'; } );
if( header[i] == aStr ) if( header[i] == aStr )
return i; return i;

View File

@ -28,6 +28,7 @@
#include <pcb_tablecell.h> #include <pcb_tablecell.h>
#include <board_item.h> #include <board_item.h>
#include <board_item_container.h> #include <board_item_container.h>
#include <algorithm>
class PCB_TABLE : public BOARD_ITEM_CONTAINER class PCB_TABLE : public BOARD_ITEM_CONTAINER
@ -179,7 +180,7 @@ public:
void DeleteMarkedCells() void DeleteMarkedCells()
{ {
alg::delete_if( m_cells, std::erase_if( m_cells,
[]( PCB_TABLECELL* cell ) []( PCB_TABLECELL* cell )
{ {
return ( cell->GetFlags() & STRUCT_DELETED ) > 0; return ( cell->GetFlags() & STRUCT_DELETED ) > 0;

View File

@ -24,6 +24,8 @@
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <algorithm>
#include <geometry/shape_rect.h> #include <geometry/shape_rect.h>
#include "pns_diff_pair.h" #include "pns_diff_pair.h"
@ -395,7 +397,7 @@ bool DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b )
void DP_GATEWAYS::FilterByOrientation( int aAngleMask, DIRECTION_45 aRefOrientation ) void DP_GATEWAYS::FilterByOrientation( int aAngleMask, DIRECTION_45 aRefOrientation )
{ {
alg::delete_if( m_gateways, std::erase_if( m_gateways,
[aAngleMask, aRefOrientation]( const DP_GATEWAY& dp ) [aAngleMask, aRefOrientation]( const DP_GATEWAY& dp )
{ {
DIRECTION_45 orient( dp.AnchorP() - dp.AnchorN() ); DIRECTION_45 orient( dp.AnchorP() - dp.AnchorN() );

View File

@ -25,6 +25,7 @@
#define PCBNEW_ROUTER_PNS_LINK_HOLDER_H_ #define PCBNEW_ROUTER_PNS_LINK_HOLDER_H_
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
#include <algorithm>
#include "pns_item.h" #include "pns_item.h"
#include "pns_linked_item.h" #include "pns_linked_item.h"
@ -49,7 +50,7 @@ public:
{ {
wxCHECK_MSG( alg::contains( m_links, aLink ), /* void */, wxCHECK_MSG( alg::contains( m_links, aLink ), /* void */,
"Trying to unlink an item that is not linked" ); "Trying to unlink an item that is not linked" );
alg::delete_matching( m_links, aLink ); std::erase( m_links, aLink );
} }
///< Return the list of links from the owning node that constitute this ///< Return the list of links from the owning node that constitute this

View File

@ -20,6 +20,9 @@
"limit_total_size": 104857600, "limit_total_size": 104857600,
"min_interval": 300 "min_interval": 300
}, },
"dialog": {
"controls": {}
},
"do_not_show_again": { "do_not_show_again": {
"data_collection_prompt": false, "data_collection_prompt": false,
"env_var_overwrite_warning": false, "env_var_overwrite_warning": false,
@ -39,7 +42,9 @@
"useDefaultAuthor": true "useDefaultAuthor": true
}, },
"graphics": { "graphics": {
"antialiasing_mode": 2,
"cairo_antialiasing_mode": 0, "cairo_antialiasing_mode": 0,
"canvas_type": 1,
"opengl_antialiasing_mode": 1 "opengl_antialiasing_mode": 1
}, },
"input": { "input": {