← Back to team overview

kicad-developers team mailing list archive

[PATCH] Replace BOOST_FOREACH with C++11 range based for

 

---
 common/config_params.cpp                           | 10 ++---
 common/dialogs/wx_html_report_panel.cpp            |  6 +--
 common/draw_panel_gal.cpp                          |  7 ++--
 common/footprint_info.cpp                          |  2 +-
 common/geometry/hetriang.cpp                       |  5 +--
 common/geometry/shape_poly_set.cpp                 | 26 ++++++------
 common/tool/action_manager.cpp                     | 11 +++--
 common/tool/tool_dispatcher.cpp                    |  5 +--
 common/tool/tool_event.cpp                         |  3 +-
 common/tool/tool_manager.cpp                       | 11 +++--
 common/view/view.cpp                               | 13 +++---
 common/view/view_group.cpp                         |  5 +--
 common/worksheet_viewitem.cpp                      |  3 +-
 eeschema/autoplace_fields.cpp                      | 23 ++++++-----
 eeschema/class_libentry.cpp                        | 47 +++++++++++-----------
 eeschema/class_library.cpp                         | 12 +++---
 eeschema/component_references_lister.cpp           |  4 +-
 eeschema/component_tree_search_container.cpp       | 19 +++++----
 eeschema/dialogs/dialog_rescue_each.cpp            |  5 +--
 eeschema/find.cpp                                  |  2 -
 eeschema/getpart.cpp                               |  4 +-
 eeschema/lib_polyline.cpp                          |  4 +-
 eeschema/libedit_plot_component.cpp                |  2 -
 eeschema/libeditframe.cpp                          |  4 +-
 eeschema/netlist.cpp                               |  1 -
 eeschema/project_rescue.cpp                        | 21 +++++-----
 eeschema/sch_bus_entry.cpp                         |  3 +-
 eeschema/sch_component.cpp                         |  7 ++--
 eeschema/sch_line.cpp                              |  4 +-
 eeschema/sch_screen.cpp                            |  3 +-
 eeschema/sch_sheet.cpp                             | 32 +++++++--------
 eeschema/sch_sheet.h                               |  3 +-
 eeschema/sch_sheet_path.cpp                        |  3 +-
 eeschema/symbedit.cpp                              |  6 +--
 include/footprint_info.h                           |  1 -
 pcbnew/autorouter/spread_footprints.cpp            |  5 +--
 pcbnew/class_pad.cpp                               |  3 +-
 pcbnew/dialogs/dialog_update_pcb.cpp               |  2 +-
 pcbnew/modview_frame.cpp                           |  2 +-
 pcbnew/netlist.cpp                                 |  2 +-
 pcbnew/ratsnest_data.cpp                           | 40 +++++++++---------
 pcbnew/ratsnest_data.h                             |  3 +-
 pcbnew/ratsnest_viewitem.cpp                       |  5 +--
 pcbnew/router/length_tuner_tool.cpp                |  1 -
 pcbnew/router/pns_diff_pair.cpp                    | 14 +++----
 pcbnew/router/pns_diff_pair_placer.cpp             |  3 +-
 pcbnew/router/pns_dp_meander_placer.cpp            | 13 +++---
 pcbnew/router/pns_dragger.cpp                      |  6 +--
 pcbnew/router/pns_index.h                          |  1 -
 pcbnew/router/pns_itemset.cpp                      | 12 +++---
 pcbnew/router/pns_itemset.h                        |  5 +--
 pcbnew/router/pns_joint.h                          |  4 +-
 pcbnew/router/pns_line.cpp                         | 11 +++--
 pcbnew/router/pns_line_placer.cpp                  |  9 ++---
 pcbnew/router/pns_meander.cpp                      |  4 +-
 pcbnew/router/pns_meander_placer.cpp               |  8 ++--
 pcbnew/router/pns_meander_placer_base.cpp          |  6 +--
 pcbnew/router/pns_meander_skew_placer.cpp          |  8 ++--
 pcbnew/router/pns_node.cpp                         | 34 ++++++++--------
 pcbnew/router/pns_optimizer.cpp                    | 10 ++---
 pcbnew/router/pns_router.cpp                       | 20 +++++----
 pcbnew/router/pns_shove.cpp                        | 24 +++++------
 pcbnew/router/pns_sizes_settings.cpp               |  2 +-
 pcbnew/router/pns_tool_base.cpp                    |  5 +--
 pcbnew/router/pns_topology.cpp                     | 14 +++----
 pcbnew/router/pns_walkaround.cpp                   |  1 -
 pcbnew/router/router_tool.cpp                      |  1 -
 pcbnew/tools/edit_points.cpp                       | 14 +++----
 pcbnew/tools/edit_tool.cpp                         |  5 +--
 pcbnew/tools/grid_helper.cpp                       |  5 +--
 pcbnew/tools/module_tools.cpp                      | 11 +++--
 pcbnew/tools/placement_tool.cpp                    |  5 +--
 pcbnew/tools/selection_tool.cpp                    | 13 +++---
 ...es_convert_brd_items_to_polygons_with_Boost.cpp |  2 -
 74 files changed, 284 insertions(+), 366 deletions(-)

diff --git a/common/config_params.cpp b/common/config_params.cpp
index 1882ac1..9737e8e 100644
--- a/common/config_params.cpp
+++ b/common/config_params.cpp
@@ -37,15 +37,13 @@
 
 #include <wildcards_and_files_ext.h>
 
-#include <boost/foreach.hpp>
-
 
 void wxConfigLoadParams( wxConfigBase* aCfg,
             const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
 {
     wxASSERT( aCfg );
 
-    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
+    for( const PARAM_CFG_BASE& param : aList )
     {
         if( !!param.m_Group )
             aCfg->SetPath( param.m_Group );
@@ -64,7 +62,7 @@ void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
 {
     wxASSERT( aCfg );
 
-    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
+    for( const PARAM_CFG_BASE& param : aList )
     {
         if( !param.m_Setup )
             continue;
@@ -79,7 +77,7 @@ void wxConfigSaveParams( wxConfigBase* aCfg,
 {
     wxASSERT( aCfg );
 
-    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
+    for( const PARAM_CFG_BASE& param : aList )
     {
         if( !!param.m_Group )
             aCfg->SetPath( param.m_Group );
@@ -106,7 +104,7 @@ void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
 {
     wxASSERT( aCfg );
 
-    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
+    for( const PARAM_CFG_BASE& param : aList )
     {
         if( !param.m_Setup )
             continue;
diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp
index c9dca09..244abfc 100644
--- a/common/dialogs/wx_html_report_panel.cpp
+++ b/common/dialogs/wx_html_report_panel.cpp
@@ -22,7 +22,7 @@
 #include "wx_html_report_panel.h"
 
 #include <wildcards_and_files_ext.h>
-#include <boost/foreach.hpp>
+
 
 WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow*      parent,
                                             wxWindowID     id,
@@ -103,7 +103,7 @@ void WX_HTML_REPORT_PANEL::refreshView()
 {
     wxString html;
 
-    BOOST_FOREACH( REPORT_LINE l, m_report )
+    for( REPORT_LINE l : m_report )
     {
         html += generateHtml( l );
     }
@@ -260,7 +260,7 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
         return;
     }
 
-    BOOST_FOREACH( REPORT_LINE l, m_report )
+    for( REPORT_LINE l : m_report )
     {
         f.Write( generatePlainText( l ) );
     }
diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index dfd74f5..fd48d83 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -39,7 +39,6 @@
 #include <tool/tool_dispatcher.h>
 #include <tool/tool_manager.h>
 
-#include <boost/foreach.hpp>
 
 #ifdef PROFILE
 #include <profile.h>
@@ -95,7 +94,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
         KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE
     };
 
-    BOOST_FOREACH( wxEventType eventType, events )
+    for( wxEventType eventType : events )
     {
         Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ),
                  NULL, m_eventDispatcher );
@@ -260,7 +259,7 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
 
     if( m_eventDispatcher )
     {
-        BOOST_FOREACH( wxEventType type, eventTypes )
+        for( wxEventType type : eventTypes )
         {
             m_parent->Connect( type, wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
                                NULL, m_eventDispatcher );
@@ -268,7 +267,7 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
     }
     else
     {
-        BOOST_FOREACH( wxEventType type, eventTypes )
+        for( wxEventType type : eventTypes )
         {
             // While loop is used to be sure that all event handlers are removed.
             while( m_parent->Disconnect( type,
diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp
index 1a84d66..dab09cf 100644
--- a/common/footprint_info.cpp
+++ b/common/footprint_info.cpp
@@ -266,7 +266,7 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
     if( aFootprintName.IsEmpty() )
         return NULL;
 
-    BOOST_FOREACH( FOOTPRINT_INFO& fp, m_list )
+    for( FOOTPRINT_INFO& fp : m_list )
     {
         FPID fpid;
 
diff --git a/common/geometry/hetriang.cpp b/common/geometry/hetriang.cpp
index e5cf26c..979372c 100644
--- a/common/geometry/hetriang.cpp
+++ b/common/geometry/hetriang.cpp
@@ -45,7 +45,6 @@
 #include <algorithm>
 #include <fstream>
 #include <limits>
-#include <boost/foreach.hpp>
 #include <boost/make_shared.hpp>
 #include <class_board_connected_item.h>
 
@@ -60,7 +59,7 @@ void NODE::updateLayers()
 {
     assert( m_layers.none() );
 
-    BOOST_FOREACH( const BOARD_CONNECTED_ITEM* item, m_parents )
+    for( const BOARD_CONNECTED_ITEM* item : m_parents )
         m_layers |= item->GetLayerSet();
 }
 
@@ -329,7 +328,7 @@ bool TRIANGULATION::removeLeadingEdgeFromList( EDGE_PTR& aLeadingEdge )
 
 void TRIANGULATION::cleanAll()
 {
-    BOOST_FOREACH( EDGE_PTR& edge, m_leadingEdges )
+    for( EDGE_PTR& edge : m_leadingEdges )
         edge->SetNextEdgeInFace( EDGE_PTR() );
 }
 
diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp
index cecc12b..1ea09d5 100644
--- a/common/geometry/shape_poly_set.cpp
+++ b/common/geometry/shape_poly_set.cpp
@@ -32,8 +32,6 @@
 #include <list>
 #include <algorithm>
 
-#include <boost/foreach.hpp>
-
 #include <geometry/shape.h>
 #include <geometry/shape_line_chain.h>
 #include <geometry/shape_poly_set.h>
@@ -214,13 +212,13 @@ void SHAPE_POLY_SET::booleanOp( ClipType aType, const SHAPE_POLY_SET& aOtherShap
     if( aFastMode == PM_STRICTLY_SIMPLE )
         c.StrictlySimple( true );
 
-    BOOST_FOREACH( const POLYGON& poly, m_polys )
+    for( const POLYGON& poly : m_polys )
     {
         for( unsigned int i = 0; i < poly.size(); i++ )
             c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptSubject, true );
     }
 
-    BOOST_FOREACH( const POLYGON& poly, aOtherShape.m_polys )
+    for( const POLYGON& poly : aOtherShape.m_polys )
     {
         for( unsigned int i = 0; i < poly.size(); i++ )
             c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptClip, true );
@@ -244,13 +242,13 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
     if( aFastMode == PM_STRICTLY_SIMPLE )
         c.StrictlySimple( true );
 
-    BOOST_FOREACH( const POLYGON& poly, aShape.m_polys )
+    for( const POLYGON& poly : aShape.m_polys )
     {
         for( unsigned int i = 0; i < poly.size(); i++ )
             c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptSubject, true );
     }
 
-    BOOST_FOREACH( const POLYGON& poly, aOtherShape.m_polys )
+    for( const POLYGON& poly : aOtherShape.m_polys )
     {
         for( unsigned int i = 0; i < poly.size(); i++ )
             c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptClip, true );
@@ -310,7 +308,7 @@ void SHAPE_POLY_SET::Inflate( int aFactor, int aCircleSegmentsCount )
 
     ClipperOffset c;
 
-    BOOST_FOREACH( const POLYGON& poly, m_polys )
+    for( const POLYGON& poly : m_polys )
     {
         for( unsigned int i = 0; i < poly.size(); i++ )
             c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), jtRound, etClosedPolygon );
@@ -488,7 +486,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
 
     int num_unconnected = 0;
 
-    BOOST_FOREACH( SHAPE_LINE_CHAIN& path, paths )
+    for( SHAPE_LINE_CHAIN& path : paths )
     {
         int index = 0;
 
@@ -580,7 +578,7 @@ void SHAPE_POLY_SET::Fracture( POLYGON_MODE aFastMode )
 {
     Simplify( aFastMode ); // remove overlapping holes/degeneracy
 
-    BOOST_FOREACH( POLYGON& paths, m_polys )
+    for( POLYGON& paths : m_polys )
     {
         fractureSingle( paths );
     }
@@ -725,7 +723,7 @@ bool SHAPE_POLY_SET::Contains( const VECTOR2I& aP, int aSubpolyIndex ) const
     if( aSubpolyIndex >= 0 )
         return pointInPolygon( aP, m_polys[aSubpolyIndex][0] );
 
-    BOOST_FOREACH ( const POLYGON& polys, m_polys )
+    for( const POLYGON& polys : m_polys )
     {
         if( polys.size() == 0 )
             continue;
@@ -805,9 +803,9 @@ bool SHAPE_POLY_SET::pointInPolygon( const VECTOR2I& aP, const SHAPE_LINE_CHAIN&
 
 void SHAPE_POLY_SET::Move( const VECTOR2I& aVector )
 {
-    BOOST_FOREACH( POLYGON &poly, m_polys )
+    for( POLYGON &poly : m_polys )
     {
-        BOOST_FOREACH( SHAPE_LINE_CHAIN &path, poly )
+        for( SHAPE_LINE_CHAIN &path : poly )
         {
             path.Move( aVector );
         }
@@ -819,9 +817,9 @@ int SHAPE_POLY_SET::TotalVertices() const
 {
     int c = 0;
 
-    BOOST_FOREACH( const POLYGON& poly, m_polys )
+    for( const POLYGON& poly : m_polys )
     {
-        BOOST_FOREACH ( const SHAPE_LINE_CHAIN& path, poly )
+        for( const SHAPE_LINE_CHAIN& path : poly )
         {
             c += path.PointCount();
         }
diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp
index fcf2006..e1cbb0b 100644
--- a/common/tool/action_manager.cpp
+++ b/common/tool/action_manager.cpp
@@ -28,7 +28,6 @@
 #include <draw_frame.h>
 
 #include <hotkeys_basic.h>
-#include <boost/foreach.hpp>
 #include <boost/range/adaptor/map.hpp>
 #include <cctype>
 #include <cassert>
@@ -39,7 +38,7 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
     // Register known actions
     std::list<TOOL_ACTION*>& actionList = GetActionList();
 
-    BOOST_FOREACH( TOOL_ACTION* action, actionList )
+    for( TOOL_ACTION* action : actionList )
     {
         if( action->m_id == -1 )
             action->m_id = MakeActionId( action->m_name );
@@ -140,7 +139,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
     const TOOL_ACTION* context = NULL;  // pointer to context action of the highest priority tool
     const TOOL_ACTION* global = NULL;   // pointer to global action, if there is no context action
 
-    BOOST_FOREACH( const TOOL_ACTION* action, actions )
+    for( const TOOL_ACTION* action : actions )
     {
         if( action->GetScope() == AS_GLOBAL )
         {
@@ -198,7 +197,7 @@ void ACTION_MANAGER::UpdateHotKeys()
     m_actionHotKeys.clear();
     m_hotkeys.clear();
 
-    BOOST_FOREACH( TOOL_ACTION* action, m_actionNameIndex | boost::adaptors::map_values )
+    for( TOOL_ACTION* action : m_actionNameIndex | boost::adaptors::map_values )
     {
         int hotkey = processHotKey( action );
 
@@ -211,11 +210,11 @@ void ACTION_MANAGER::UpdateHotKeys()
 
 #ifndef NDEBUG
     // Check if there are two global actions assigned to the same hotkey
-    BOOST_FOREACH( std::list<TOOL_ACTION*>& action_list, m_actionHotKeys | boost::adaptors::map_values )
+    for( std::list<TOOL_ACTION*>& action_list : m_actionHotKeys | boost::adaptors::map_values )
     {
         int global_actions_cnt = 0;
 
-        BOOST_FOREACH( TOOL_ACTION* action, action_list )
+        for( TOOL_ACTION* action : action_list )
         {
             if( action->GetScope() == AS_GLOBAL )
                 ++global_actions_cnt;
diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp
index 4ee9ebc..bb7bfcd 100644
--- a/common/tool/tool_dispatcher.cpp
+++ b/common/tool/tool_dispatcher.cpp
@@ -35,7 +35,6 @@
 #include <pcbnew_id.h>
 
 #include <boost/optional.hpp>
-#include <boost/foreach.hpp>
 
 ///> Stores information about a mouse button state
 struct TOOL_DISPATCHER::BUTTON_STATE
@@ -131,14 +130,14 @@ TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr ) :
 
 TOOL_DISPATCHER::~TOOL_DISPATCHER()
 {
-    BOOST_FOREACH( BUTTON_STATE* st, m_buttons )
+    for( BUTTON_STATE* st : m_buttons )
         delete st;
 }
 
 
 void TOOL_DISPATCHER::ResetState()
 {
-    BOOST_FOREACH( BUTTON_STATE* st, m_buttons )
+    for( BUTTON_STATE* st : m_buttons )
         st->Reset();
 }
 
diff --git a/common/tool/tool_event.cpp b/common/tool/tool_event.cpp
index 68518a2..f46ca0d 100644
--- a/common/tool/tool_event.cpp
+++ b/common/tool/tool_event.cpp
@@ -29,7 +29,6 @@
 #include <tool/tool_action.h>
 #include <tool/tool_manager.h>
 
-#include <boost/foreach.hpp>
 
 struct FlagString
 {
@@ -155,7 +154,7 @@ const std::string TOOL_EVENT_LIST::Format() const
 {
     std::string s;
 
-    BOOST_FOREACH( TOOL_EVENT e, m_events )
+    for( TOOL_EVENT e : m_events )
         s += e.Format() + " ";
 
     return s;
diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp
index 836b978..f40cdc3 100644
--- a/common/tool/tool_manager.cpp
+++ b/common/tool/tool_manager.cpp
@@ -28,7 +28,6 @@
 #include <stack>
 #include <algorithm>
 
-#include <boost/foreach.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/optional.hpp>
 #include <boost/range/adaptor/map.hpp>
@@ -434,7 +433,7 @@ void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
     TOOL_EVENT evt( TC_COMMAND, TA_ACTIVATE, "" );      // deactivate the active tool
     ProcessEvent( evt );
 
-    BOOST_FOREACH( TOOL_BASE* tool, m_toolState | boost::adaptors::map_keys )
+    for( TOOL_BASE* tool : m_toolState | boost::adaptors::map_keys )
     {
         tool->Reset( aReason );
         tool->SetTransitions();
@@ -490,7 +489,7 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
 void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
 {
     // iterate over all registered tools
-    BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
+    for( TOOL_ID toolId : m_activeTools )
     {
         TOOL_STATE* st = m_toolIdIndex[toolId];
 
@@ -518,13 +517,13 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
         }
     }
 
-    BOOST_FOREACH( TOOL_STATE* st, m_toolState | boost::adaptors::map_values )
+    for( TOOL_STATE* st : m_toolState | boost::adaptors::map_values )
     {
         // no state handler in progress - check if there are any transitions (defined by
         // Go() method that match the event.
         if( !st->pendingWait && !st->transitions.empty() )
         {
-            BOOST_FOREACH( TRANSITION& tr, st->transitions )
+            for( TRANSITION& tr : st->transitions )
             {
                 if( tr.first.Matches( aEvent ) )
                 {
@@ -584,7 +583,7 @@ bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
 
 void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
 {
-    BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
+    for( TOOL_ID toolId : m_activeTools )
     {
         TOOL_STATE* st = m_toolIdIndex[toolId];
 
diff --git a/common/view/view.cpp b/common/view/view.cpp
index d3553c0..c58193b 100644
--- a/common/view/view.cpp
+++ b/common/view/view.cpp
@@ -23,7 +23,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-#include <boost/foreach.hpp>
 
 #include <base_struct.h>
 #include <layers_id_colors_and_visibility.h>
@@ -66,7 +65,7 @@ VIEW::VIEW( bool aIsDynamic ) :
 
 VIEW::~VIEW()
 {
-    BOOST_FOREACH( LAYER_MAP::value_type& l, m_layers )
+    for( LAYER_MAP::value_type& l : m_layers )
         delete l.second.items;
 }
 
@@ -576,7 +575,7 @@ void VIEW::UpdateAllLayersOrder()
 {
     sortLayers();
 
-    BOOST_FOREACH( LAYER_MAP::value_type& l, m_layers )
+    for( LAYER_MAP::value_type& l : m_layers )
     {
         ChangeLayerDepth( l.first, l.second.renderingOrder );
     }
@@ -612,7 +611,7 @@ struct VIEW::drawItem
 
 void VIEW::redrawRect( const BOX2I& aRect )
 {
-    BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
+    for( VIEW_LAYER* l : m_orderedLayers )
     {
         if( l->visible && IsTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) )
         {
@@ -727,7 +726,7 @@ void VIEW::Clear()
 
     r.SetMaximum();
 
-    BOOST_FOREACH( VIEW_ITEM* item, m_needsUpdate )
+    for( VIEW_ITEM* item : m_needsUpdate )
         item->clearUpdateFlags();
 
     m_needsUpdate.clear();
@@ -1015,7 +1014,7 @@ void VIEW::UpdateItems()
 {
     m_gal->BeginUpdate();
 
-    BOOST_FOREACH( VIEW_ITEM* item, m_needsUpdate )
+    for( VIEW_ITEM* item : m_needsUpdate )
     {
         assert( item->viewRequiredUpdate() != VIEW_ITEM::NONE );
 
@@ -1054,7 +1053,7 @@ const BOX2I VIEW::CalculateExtents()
     BOX2I fullScene;
     fullScene.SetMaximum();
 
-    BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
+    for( VIEW_LAYER* l : m_orderedLayers )
     {
         l->items->Query( fullScene, v );
     }
diff --git a/common/view/view_group.cpp b/common/view/view_group.cpp
index 1459954..afcd7af 100644
--- a/common/view/view_group.cpp
+++ b/common/view/view_group.cpp
@@ -36,7 +36,6 @@
 #include <view/view.h>
 #include <painter.h>
 #include <gal/graphics_abstraction_layer.h>
-#include <boost/foreach.hpp>
 #include <layers_id_colors_and_visibility.h>
 
 using namespace KIGFX;
@@ -91,7 +90,7 @@ void VIEW_GROUP::ViewDraw( int aLayer, GAL* aGal ) const
     PAINTER* painter = m_view->GetPainter();
 
     // Draw all items immediately (without caching)
-    BOOST_FOREACH( VIEW_ITEM* item, m_items )
+    for( VIEW_ITEM* item : m_items )
     {
         aGal->PushDepth();
 
@@ -125,7 +124,7 @@ void VIEW_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const
 
 void VIEW_GROUP::FreeItems()
 {
-    BOOST_FOREACH( VIEW_ITEM* item, m_items )
+    for( VIEW_ITEM* item : m_items )
     {
         delete item;
     }
diff --git a/common/worksheet_viewitem.cpp b/common/worksheet_viewitem.cpp
index 5a8e27c..9c09a24 100644
--- a/common/worksheet_viewitem.cpp
+++ b/common/worksheet_viewitem.cpp
@@ -32,7 +32,6 @@
 #include <gal/graphics_abstraction_layer.h>
 #include <painter.h>
 #include <layers_id_colors_and_visibility.h>
-#include <boost/foreach.hpp>
 #include <class_page_info.h>
 
 using namespace KIGFX;
@@ -160,7 +159,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_RECT* aItem, GAL* aGal ) const
 void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_POLYGON* aItem, GAL* aGal ) const
 {
     std::deque<VECTOR2D> corners;
-    BOOST_FOREACH( wxPoint point, aItem->m_Corners )
+    for( wxPoint point : aItem->m_Corners )
     {
         corners.push_back( VECTOR2D( point ) );
     }
diff --git a/eeschema/autoplace_fields.cpp b/eeschema/autoplace_fields.cpp
index 7eed508..cccf155 100644
--- a/eeschema/autoplace_fields.cpp
+++ b/eeschema/autoplace_fields.cpp
@@ -50,6 +50,8 @@
  *      2. Round to a 50-mil grid coordinate if desired
  */
 
+#include <boost/range/adaptor/reversed.hpp>
+
 #include <schframe.h>
 #include <hotkeys_basic.h>
 #include <sch_component.h>
@@ -59,7 +61,6 @@
 #include <class_libentry.h>
 #include <eeschema_config.h>
 #include <kiface_i.h>
-#include <boost/foreach.hpp>
 #include <vector>
 #include <algorithm>
 
@@ -187,7 +188,7 @@ protected:
         int max_field_width = 0;
         int total_height = 0;
 
-        BOOST_FOREACH( SCH_FIELD* field, m_fields )
+        for( SCH_FIELD* field : m_fields )
         {
             int field_width;
             int field_height;
@@ -248,7 +249,7 @@ protected:
         std::vector<LIB_PIN*> pins;
         m_component->GetPins( pins );
 
-        BOOST_FOREACH( LIB_PIN* each_pin, pins )
+        for( LIB_PIN* each_pin : pins )
         {
             if( !each_pin->IsVisible() && !m_power_symbol )
                 continue;
@@ -277,7 +278,7 @@ protected:
 
                 std::vector<SCH_FIELD*> fields;
                 comp->GetFields( fields, /* aVisibleOnly */ true );
-                BOOST_FOREACH( SCH_FIELD* field, fields )
+                for( SCH_FIELD* field : fields )
                     aItems.push_back( field );
             }
             aItems.push_back( item );
@@ -293,7 +294,7 @@ protected:
     std::vector<SCH_ITEM*> filtered_colliders( const EDA_RECT& aRect )
     {
         std::vector<SCH_ITEM*> filtered;
-        BOOST_FOREACH( SCH_ITEM* item, m_colliders )
+        for( SCH_ITEM* item : m_colliders )
         {
             EDA_RECT item_box;
             if( SCH_COMPONENT* item_comp = dynamic_cast<SCH_COMPONENT*>( item ) )
@@ -389,12 +390,12 @@ protected:
         std::vector<SIDE_AND_COLL> colliding;
 
         // Iterate over all sides and find the ones that collide
-        BOOST_FOREACH( SIDE side, sides )
+        for( SIDE side : sides )
         {
             EDA_RECT box( field_box_placement( side ), m_fbox_size );
 
             COLLISION collision = COLLIDE_NONE;
-            BOOST_FOREACH( SCH_ITEM* collider, filtered_colliders( box ) )
+            for( SCH_ITEM* collider : filtered_colliders( box ) )
             {
                 SCH_LINE* line = dynamic_cast<SCH_LINE*>( collider );
                 if( line && !side.x )
@@ -432,7 +433,7 @@ protected:
         while( it != aSides.end() )
         {
             bool collide = false;
-            BOOST_FOREACH( SIDE_AND_COLL collision, aCollidingSides )
+            for( SIDE_AND_COLL collision : aCollidingSides )
             {
                 if( collision.side == it->side && collision.collision == aCollision )
                     collide = true;
@@ -473,12 +474,12 @@ protected:
             side = choose_side_filtered( sides, colliding_sides, COLLIDE_H_WIRES, side );
         }
 
-        BOOST_REVERSE_FOREACH( SIDE_AND_NPINS& each_side, sides )
+        for( SIDE_AND_NPINS& each_side : sides | boost::adaptors::reversed )
         {
             if( !each_side.pins ) return each_side.side;
         }
 
-        BOOST_FOREACH( SIDE_AND_NPINS& each_side, sides )
+        for( SIDE_AND_NPINS& each_side : sides )
         {
             if( each_side.pins <= side.pins )
             {
@@ -545,7 +546,7 @@ protected:
         // Find the offset of the wires for proper positioning
         int offset = 0;
 
-        BOOST_FOREACH( SCH_ITEM* item, colliders )
+        for( SCH_ITEM* item : colliders )
         {
             SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
             if( !line )
diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
index e060151..96ad5cc 100644
--- a/eeschema/class_libentry.cpp
+++ b/eeschema/class_libentry.cpp
@@ -49,7 +49,6 @@
 #include <lib_rectangle.h>
 #include <lib_text.h>
 
-#include <boost/foreach.hpp>
 
 // the separator char between the subpart id and the reference
 // 0 (no separator) or '.' or some other character
@@ -224,7 +223,7 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) :
     m_dateModified        = aPart.m_dateModified;
     m_options             = aPart.m_options;
 
-    BOOST_FOREACH( LIB_ITEM& oldItem, aPart.GetDrawItemList() )
+    for( LIB_ITEM& oldItem : aPart.GetDrawItemList() )
     {
         if( oldItem.IsNew() )
             continue;
@@ -327,7 +326,7 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
     if( ! (screen && screen->m_IsPrinting && GetGRForceBlackPenState())
             && (aColor == UNSPECIFIED_COLOR) )
     {
-        BOOST_FOREACH( LIB_ITEM& drawItem, drawings )
+        for( LIB_ITEM& drawItem : drawings )
         {
             if( drawItem.m_Fill != FILLED_WITH_BG_BODYCOLOR )
                 continue;
@@ -363,7 +362,7 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
     // Track the index into the dangling pins list
     size_t pin_index = 0;
 
-    BOOST_FOREACH( LIB_ITEM& drawItem, drawings )
+    for( LIB_ITEM& drawItem : drawings )
     {
         if( aOnlySelected && !drawItem.IsSelected() )
             continue;
@@ -446,7 +445,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
 
     // draw background for filled items using background option
     // Solid lines will be drawn after the background
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         // Lib Fields are not plotted here, because this plot function
         // is used to plot schematic items, which have they own fields
@@ -465,7 +464,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
 
     // Not filled items and filled shapes are now plotted
     // (plot only items which are not already plotted)
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( item.Type() == LIB_FIELD_T )
             continue;
@@ -489,7 +488,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
     aPlotter->SetColor( GetLayerColor( LAYER_FIELDS ) );
     bool fill = aPlotter->GetColorMode();
 
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( item.Type() != LIB_FIELD_T )
             continue;
@@ -607,7 +606,7 @@ void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert )
      * when .m_Unit == 0, the body item is common to units
      * when .m_Convert == 0, the body item is common to shapes
      */
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( item.Type() != LIB_PIN_T )    // we search pins only
             continue;
@@ -652,14 +651,14 @@ bool LIB_PART::PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTes
     LIB_PINS thisPinList;
     GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
 
-    BOOST_FOREACH( LIB_PIN* eachThisPin, thisPinList )
+    for( LIB_PIN* eachThisPin : thisPinList )
     {
         wxASSERT( eachThisPin );
         LIB_PINS otherPinList;
         aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
         bool foundMatch = false;
 
-        BOOST_FOREACH( LIB_PIN* eachOtherPin, otherPinList )
+        for( LIB_PIN* eachOtherPin : otherPinList )
         {
             wxASSERT( eachOtherPin );
             // Same position?
@@ -822,7 +821,7 @@ bool LIB_PART::Save( OUTPUTFORMATTER& aFormatter )
 
         aFormatter.Print( 0, "DRAW\n" );
 
-        BOOST_FOREACH( LIB_ITEM& item, drawings )
+        for( LIB_ITEM& item : drawings )
         {
             if( item.Type() == LIB_FIELD_T )
                 continue;
@@ -1275,7 +1274,7 @@ void LIB_PART::GetFields( LIB_FIELDS& aList )
     }
 
     // Now grab all the rest of fields.
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( item.Type() != LIB_FIELD_T )
             continue;
@@ -1292,7 +1291,7 @@ void LIB_PART::GetFields( LIB_FIELDS& aList )
 
 LIB_FIELD* LIB_PART::GetField( int aId )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( item.Type() != LIB_FIELD_T )
             continue;
@@ -1309,7 +1308,7 @@ LIB_FIELD* LIB_PART::GetField( int aId )
 
 LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( item.Type() != LIB_FIELD_T )
             continue;
@@ -1381,7 +1380,7 @@ bool LIB_PART::LoadDateAndTime( char* aLine )
 
 void LIB_PART::SetOffset( const wxPoint& aOffset )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         item.SetOffset( aOffset );
     }
@@ -1409,7 +1408,7 @@ bool LIB_PART::HasConversion() const
 
 void LIB_PART::ClearStatus()
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         item.m_Flags = 0;
     }
@@ -1420,7 +1419,7 @@ int LIB_PART::SelectItems( EDA_RECT& aRect, int aUnit, int aConvert, bool aEditP
 {
     int itemCount = 0;
 
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         item.ClearFlags( SELECTED );
 
@@ -1449,7 +1448,7 @@ int LIB_PART::SelectItems( EDA_RECT& aRect, int aUnit, int aConvert, bool aEditP
 
 void LIB_PART::MoveSelectedItems( const wxPoint& aOffset )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( !item.IsSelected() )
             continue;
@@ -1464,7 +1463,7 @@ void LIB_PART::MoveSelectedItems( const wxPoint& aOffset )
 
 void LIB_PART::ClearSelectedItems()
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         item.m_Flags = 0;
     }
@@ -1536,7 +1535,7 @@ void LIB_PART::CopySelectedItems( const wxPoint& aOffset )
 
 void LIB_PART::MirrorSelectedItemsH( const wxPoint& aCenter )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( !item.IsSelected() )
             continue;
@@ -1550,7 +1549,7 @@ void LIB_PART::MirrorSelectedItemsH( const wxPoint& aCenter )
 
 void LIB_PART::MirrorSelectedItemsV( const wxPoint& aCenter )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( !item.IsSelected() )
             continue;
@@ -1564,7 +1563,7 @@ void LIB_PART::MirrorSelectedItemsV( const wxPoint& aCenter )
 
 void LIB_PART::RotateSelectedItems( const wxPoint& aCenter )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( !item.IsSelected() )
             continue;
@@ -1581,7 +1580,7 @@ void LIB_PART::RotateSelectedItems( const wxPoint& aCenter )
 LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
                                     KICAD_T aType, const wxPoint& aPoint )
 {
-    BOOST_FOREACH( LIB_ITEM& item, drawings )
+    for( LIB_ITEM& item : drawings )
     {
         if( ( aUnit && item.m_Unit && ( aUnit != item.m_Unit) )
             || ( aConvert && item.m_Convert && ( aConvert != item.m_Convert ) )
@@ -1674,7 +1673,7 @@ void LIB_PART::SetConversion( bool aSetConvert )
     {
         std::vector< LIB_ITEM* > tmp;     // Temporarily store the duplicated pins here.
 
-        BOOST_FOREACH( LIB_ITEM& item, drawings )
+        for( LIB_ITEM& item : drawings )
         {
             // Only pins are duplicated.
             if( item.Type() != LIB_PIN_T )
diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp
index 31372db..5e27a6e 100644
--- a/eeschema/class_library.cpp
+++ b/eeschema/class_library.cpp
@@ -43,8 +43,6 @@
 #include <general.h>
 #include <class_library.h>
 
-#include <boost/foreach.hpp>
-
 #include <wx/tokenzr.h>
 #include <wx/regex.h>
 
@@ -896,7 +894,7 @@ wxArrayString PART_LIBS::GetLibraryNames( bool aSorted )
     wxArrayString cacheNames;
     wxArrayString names;
 
-    BOOST_FOREACH( PART_LIB& lib, *this )
+    for( PART_LIB& lib : *this )
     {
         if( lib.IsCache() && aSorted )
             cacheNames.Add( lib.GetName() );
@@ -919,7 +917,7 @@ LIB_PART* PART_LIBS::FindLibPart( const wxString& aPartName, const wxString& aLi
 {
     LIB_PART* part = NULL;
 
-    BOOST_FOREACH( PART_LIB& lib, *this )
+    for( PART_LIB& lib : *this )
     {
         if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
             continue;
@@ -938,7 +936,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aEntryName, const wxStri
 {
     LIB_ALIAS* entry = NULL;
 
-    BOOST_FOREACH( PART_LIB& lib, *this )
+    for( PART_LIB& lib : *this )
     {
         if( !!aLibraryName && lib.GetName() != aLibraryName )
             continue;
@@ -954,7 +952,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aEntryName, const wxStri
 
 void PART_LIBS::FindLibraryEntries( const wxString& aEntryName, std::vector<LIB_ALIAS*>& aEntries )
 {
-    BOOST_FOREACH( PART_LIB& lib, *this )
+    for( PART_LIB& lib : *this )
     {
         LIB_ALIAS* entry = lib.FindEntry( aEntryName );
 
@@ -970,7 +968,7 @@ void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates,
                                         const wxString& aEntryName,
                                         const wxString& aLibraryName )
 {
-    BOOST_FOREACH( PART_LIB& lib, *this )
+    for( PART_LIB& lib : *this )
     {
         if( !!aLibraryName && lib.GetName() != aLibraryName )
             continue;
diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp
index 596b3bd..ce19776 100644
--- a/eeschema/component_references_lister.cpp
+++ b/eeschema/component_references_lister.cpp
@@ -39,8 +39,6 @@
 #include <sch_reference_list.h>
 #include <sch_component.h>
 
-#include <boost/foreach.hpp>
-
 
 //#define USE_OLD_ALGO
 
@@ -332,7 +330,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId,
 
         // Check whether this component is in aLockedUnitMap.
         SCH_REFERENCE_LIST* lockedList = NULL;
-        BOOST_FOREACH( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair, aLockedUnitMap )
+        for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : aLockedUnitMap )
         {
             unsigned n_refs = pair.second.GetCount();
             for( unsigned thisRefI = 0; thisRefI < n_refs; ++thisRefI )
diff --git a/eeschema/component_tree_search_container.cpp b/eeschema/component_tree_search_container.cpp
index e6ec911..01cc334 100644
--- a/eeschema/component_tree_search_container.cpp
+++ b/eeschema/component_tree_search_container.cpp
@@ -24,7 +24,6 @@
 #include <component_tree_search_container.h>
 
 #include <algorithm>
-#include <boost/foreach.hpp>
 #include <set>
 
 #include <wx/string.h>
@@ -113,7 +112,7 @@ COMPONENT_TREE_SEARCH_CONTAINER::COMPONENT_TREE_SEARCH_CONTAINER( PART_LIBS* aLi
 
 COMPONENT_TREE_SEARCH_CONTAINER::~COMPONENT_TREE_SEARCH_CONTAINER()
 {
-    BOOST_FOREACH( TREE_NODE* node, m_nodes )
+    for( TREE_NODE* node : m_nodes )
         delete node;
 
     m_nodes.clear();
@@ -158,7 +157,7 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
                                                aNodeName, wxEmptyString, wxEmptyString );
     m_nodes.push_back( lib_node );
 
-    BOOST_FOREACH( const wxString& aName, aAliasNameList )
+    for( const wxString& aName : aAliasNameList )
     {
         LIB_ALIAS* a;
 
@@ -226,7 +225,7 @@ LIB_ALIAS* COMPONENT_TREE_SEARCH_CONTAINER::GetSelectedAlias( int* aUnit )
 
     const wxTreeItemId& select_id = m_tree->GetSelection();
 
-    BOOST_FOREACH( TREE_NODE* node, m_nodes )
+    for( TREE_NODE* node : m_nodes )
     {
         if( node->MatchScore > 0 && node->TreeId == select_id )
         {
@@ -272,7 +271,7 @@ public:
 
     ~EDA_COMBINED_MATCHER()
     {
-        BOOST_FOREACH( const EDA_PATTERN_MATCH* matcher, m_matchers )
+        for( const EDA_PATTERN_MATCH* matcher : m_matchers )
             delete matcher;
     }
 
@@ -284,7 +283,7 @@ public:
     {
         int result = EDA_PATTERN_NOT_FOUND;
 
-        BOOST_FOREACH( const EDA_PATTERN_MATCH* matcher, m_matchers )
+        for( const EDA_PATTERN_MATCH* matcher : m_matchers )
         {
             int local_find = matcher->Find( aTerm );
 
@@ -336,7 +335,7 @@ void COMPONENT_TREE_SEARCH_CONTAINER::UpdateSearchTerm( const wxString& aSearch
     // on an i5. Good enough, no index needed.
 
     // Initial AND condition: Leaf nodes are considered to match initially.
-    BOOST_FOREACH( TREE_NODE* node, m_nodes )
+    for( TREE_NODE* node : m_nodes )
     {
         node->PreviousScore = node->MatchScore;
         node->MatchScore = ( node->Type == TREE_NODE::TYPE_LIB ) ? 0 : kLowestDefaultScore;
@@ -360,7 +359,7 @@ void COMPONENT_TREE_SEARCH_CONTAINER::UpdateSearchTerm( const wxString& aSearch
         const wxString term = tokenizer.GetNextToken().Lower();
         EDA_COMBINED_MATCHER matcher( term );
 
-        BOOST_FOREACH( TREE_NODE* node, m_nodes )
+        for( TREE_NODE* node : m_nodes )
         {
             if( node->Type != TREE_NODE::TYPE_ALIAS )
                 continue;      // Only aliases are actually scored here.
@@ -406,7 +405,7 @@ void COMPONENT_TREE_SEARCH_CONTAINER::UpdateSearchTerm( const wxString& aSearch
     unsigned highest_score_seen = 0;
     bool any_change = false;
 
-    BOOST_FOREACH( TREE_NODE* node, m_nodes )
+    for( TREE_NODE* node : m_nodes )
     {
         switch( node->Type )
         {
@@ -447,7 +446,7 @@ void COMPONENT_TREE_SEARCH_CONTAINER::UpdateSearchTerm( const wxString& aSearch
     const TREE_NODE* first_match = NULL;
     const TREE_NODE* preselected_node = NULL;
 
-    BOOST_FOREACH( TREE_NODE* node, m_nodes )
+    for( TREE_NODE* node : m_nodes )
     {
         if( node->MatchScore == 0 )
             continue;
diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp
index 7c67b94..144e765 100644
--- a/eeschema/dialogs/dialog_rescue_each.cpp
+++ b/eeschema/dialogs/dialog_rescue_each.cpp
@@ -31,7 +31,6 @@
 #include <class_libentry.h>
 #include <set>
 #include <vector>
-#include <boost/foreach.hpp>
 #include <project_rescue.h>
 #include <eeschema_config.h>
 
@@ -127,7 +126,7 @@ bool DIALOG_RESCUE_EACH::TransferDataToWindow()
 void DIALOG_RESCUE_EACH::PopulateConflictList()
 {
     wxVector<wxVariant> data;
-    BOOST_FOREACH( RESCUE_CANDIDATE& each_candidate, m_Rescuer->m_all_candidates )
+    for( RESCUE_CANDIDATE& each_candidate : m_Rescuer->m_all_candidates )
     {
         data.clear();
         data.push_back( wxVariant( true ) );
@@ -151,7 +150,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
     RESCUE_CANDIDATE& selected_part = m_Rescuer->m_all_candidates[row];
 
     wxVector<wxVariant> data;
-    BOOST_FOREACH( SCH_COMPONENT* each_component, *m_Rescuer->GetComponents() )
+    for( SCH_COMPONENT* each_component : *m_Rescuer->GetComponents() )
     {
         if( each_component->GetPartName() != selected_part.GetRequestedName() )
             continue;
diff --git a/eeschema/find.cpp b/eeschema/find.cpp
index c3f3417..6515cda 100644
--- a/eeschema/find.cpp
+++ b/eeschema/find.cpp
@@ -52,8 +52,6 @@
 
 #include <kicad_device_context.h>
 
-#include <boost/foreach.hpp>
-
 #include <dialogs/dialog_schematic_find.h>
 
 
diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp
index 6e119ae..5a922f1 100644
--- a/eeschema/getpart.cpp
+++ b/eeschema/getpart.cpp
@@ -49,8 +49,6 @@
 #include <component_tree_search_container.h>
 #include <dialog_get_component.h>
 
-#include <boost/foreach.hpp>
-
 
 wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( const SCHLIB_FILTER* aFilter,
                                                         LIB_ALIAS* aPreselectedAlias,
@@ -133,7 +131,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const SCHLIB_FILTER* aFilte
 
     if( !loaded )
     {
-        BOOST_FOREACH( PART_LIB& lib, *libs )
+        for( PART_LIB& lib : *libs )
         {
             search_container.AddLibrary( lib );
         }
diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp
index 826adca..b568956 100644
--- a/eeschema/lib_polyline.cpp
+++ b/eeschema/lib_polyline.cpp
@@ -41,8 +41,6 @@
 #include <lib_polyline.h>
 #include <transform.h>
 
-#include <boost/foreach.hpp>
-
 
 LIB_POLYLINE::LIB_POLYLINE( LIB_PART*      aParent ) :
     LIB_ITEM( LIB_POLYLINE_T, aParent )
@@ -450,7 +448,7 @@ void LIB_POLYLINE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
         wxPoint prevPoint = startPoint;
 
         // Find the right index of the point to be dragged
-        BOOST_FOREACH( wxPoint point, m_PolyPoints )
+        for( wxPoint point : m_PolyPoints )
         {
             int distancePoint = (aPosition - point).x * (aPosition - point).x +
                                 (aPosition - point).y * (aPosition - point).y;
diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp
index 98fad7b..a7b70ba 100644
--- a/eeschema/libedit_plot_component.cpp
+++ b/eeschema/libedit_plot_component.cpp
@@ -41,8 +41,6 @@
 #include <class_library.h>
 #include <dialogs/dialog_plot_schematic.h>
 
-#include <boost/foreach.hpp>
-
 
 void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
 {
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index c9d102d..e89fd95 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -54,8 +54,6 @@
 
 #include <menus_helpers.h>
 
-#include <boost/foreach.hpp>
-
 
 /* This method guarantees unique IDs for the library this run of Eeschema
  * which prevents ID conflicts and eliminates the need to recompile every
@@ -336,7 +334,7 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
 
     PART_LIBS* libs = Prj().SchLibs();
 
-    BOOST_FOREACH( const PART_LIB& lib, *libs )
+    for( const PART_LIB& lib : *libs )
     {
         if( lib.IsModified() )
         {
diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp
index 4d9425c..4dd4008 100644
--- a/eeschema/netlist.cpp
+++ b/eeschema/netlist.cpp
@@ -45,7 +45,6 @@
 #include <sch_sheet.h>
 #include <algorithm>
 #include <invoke_sch_dialog.h>
-#include <boost/foreach.hpp>
 
 #define IS_WIRE false
 #define IS_BUS true
diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp
index 374a7df..39179b5 100644
--- a/eeschema/project_rescue.cpp
+++ b/eeschema/project_rescue.cpp
@@ -34,7 +34,6 @@
 #include <wildcards_and_files_ext.h>
 
 #include <cctype>
-#include <boost/foreach.hpp>
 #include <map>
 
 
@@ -183,7 +182,7 @@ static LIB_PART* find_component( wxString aName, PART_LIBS* aLibs, bool aCached
 {
     LIB_PART *part = NULL;
 
-    BOOST_FOREACH( PART_LIB& each_lib, *aLibs )
+    for( PART_LIB& each_lib : *aLibs )
     {
         if( aCached && !each_lib.IsCache() )
             continue;
@@ -208,7 +207,7 @@ void RESCUER::RemoveDuplicates()
             it != m_all_candidates.end(); )
     {
         bool seen_already = false;
-        BOOST_FOREACH( wxString& name_seen, names_seen )
+        for( wxString& name_seen : names_seen )
         {
             if( name_seen == it->GetRequestedName() )
             {
@@ -248,7 +247,7 @@ public:
         typedef std::map<wxString, RESCUE_CASE_CANDIDATE> candidate_map_t;
         candidate_map_t candidate_map;
 
-        BOOST_FOREACH( SCH_COMPONENT* each_component, *( aRescuer.GetComponents() ) )
+        for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
         {
             wxString part_name( each_component->GetPartName() );
 
@@ -266,7 +265,7 @@ public:
         }
 
         // Now, dump the map into aCandidates
-        BOOST_FOREACH( const candidate_map_t::value_type& each_pair, candidate_map )
+        for( const candidate_map_t::value_type& each_pair : candidate_map )
         {
             aCandidates.push_back( new RESCUE_CASE_CANDIDATE( each_pair.second ) );
         }
@@ -298,7 +297,7 @@ public:
 
     virtual bool PerformAction( RESCUER* aRescuer )
     {
-        BOOST_FOREACH( SCH_COMPONENT* each_component, *aRescuer->GetComponents() )
+        for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
         {
             if( each_component->GetPartName() != m_requested_name ) continue;
             each_component->SetPartName( m_new_name );
@@ -334,7 +333,7 @@ public:
 
         wxString part_name_suffix = aRescuer.GetPartNameSuffix();
 
-        BOOST_FOREACH( SCH_COMPONENT* each_component, *( aRescuer.GetComponents() ) )
+        for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
         {
             wxString part_name( each_component->GetPartName() );
 
@@ -356,7 +355,7 @@ public:
         }
 
         // Now, dump the map into aCandidates
-        BOOST_FOREACH( const candidate_map_t::value_type& each_pair, candidate_map )
+        for( const candidate_map_t::value_type& each_pair : candidate_map )
         {
             aCandidates.push_back( new RESCUE_CACHE_CANDIDATE( each_pair.second ) );
         }
@@ -416,7 +415,7 @@ public:
         new_part.RemoveAllAliases();
         RESCUE_CACHE_CANDIDATE::m_rescue_lib.get()->AddPart( &new_part );
 
-        BOOST_FOREACH( SCH_COMPONENT* each_component, *aRescuer->GetComponents() )
+        for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
         {
             if( each_component->GetPartName() != m_requested_name ) continue;
             each_component->SetPartName( m_new_name );
@@ -479,7 +478,7 @@ void RESCUER::LogRescue( SCH_COMPONENT *aComponent, const wxString &aOldName,
 
 bool RESCUER::DoRescues()
 {
-    BOOST_FOREACH( RESCUE_CANDIDATE* each_candidate, m_chosen_candidates )
+    for( RESCUE_CANDIDATE* each_candidate : m_chosen_candidates )
     {
         if( ! each_candidate->PerformAction( this ) )
             return false;
@@ -490,7 +489,7 @@ bool RESCUER::DoRescues()
 
 void RESCUER::UndoRescues()
 {
-    BOOST_FOREACH( RESCUE_LOG& each_logitem, m_rescue_log )
+    for( RESCUE_LOG& each_logitem : m_rescue_log )
     {
         each_logitem.component->SetPartName( each_logitem.old_name );
         each_logitem.component->ClearFlags();
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index 9ac8806..8e772f8 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -35,7 +35,6 @@
 #include <common.h>
 #include <richio.h>
 #include <plot_common.h>
-#include <boost/foreach.hpp>
 
 #include <eeschema_config.h>
 #include <general.h>
@@ -264,7 +263,7 @@ bool SCH_BUS_ENTRY_BASE::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>&
     bool start_is_wire = false;
     bool end_is_wire = false;
 
-    BOOST_FOREACH( DANGLING_END_ITEM& each_item, aItemList )
+    for( DANGLING_END_ITEM& each_item : aItemList )
     {
         if( each_item.GetItem() == this )
             continue;
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 95e96b2..4981d5b 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -36,7 +36,6 @@
 #include <schframe.h>
 #include <plot_common.h>
 #include <msgpanel.h>
-#include <boost/foreach.hpp>
 
 #include <general.h>
 #include <class_library.h>
@@ -666,7 +665,7 @@ SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
 
 void SCH_COMPONENT::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly )
 {
-    BOOST_FOREACH( SCH_FIELD& each_field, m_Fields )
+    for( SCH_FIELD& each_field : m_Fields )
     {
         if( !aVisibleOnly || ( each_field.IsVisible() && !each_field.IsVoid() ) )
             aVector.push_back( &each_field );
@@ -1671,7 +1670,7 @@ bool SCH_COMPONENT::IsPinDanglingStateChanged( std::vector<DANGLING_END_ITEM> &a
 
     wxPoint pin_position = GetPinPhysicalPosition( aLibPins[aPin] );
 
-    BOOST_FOREACH( DANGLING_END_ITEM& each_item, aItemList )
+    for( DANGLING_END_ITEM& each_item : aItemList )
     {
         // Some people like to stack pins on top of each other in a symbol to indicate
         // internal connection. While technically connected, it is not particularly useful
@@ -1727,7 +1726,7 @@ bool SCH_COMPONENT::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aIte
 
 bool SCH_COMPONENT::IsDangling() const
 {
-    BOOST_FOREACH( bool each, m_isDangling )
+    for( bool each : m_isDangling )
     {
         if( each )
             return true;
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 72efb5c..c25e2fb 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -39,8 +39,6 @@
 #include <sch_line.h>
 #include <class_netlist_object.h>
 
-#include <boost/foreach.hpp>
-
 
 SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
     SCH_ITEM( NULL, SCH_LINE_T )
@@ -389,7 +387,7 @@ bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
 
     if( GetLayer() == LAYER_WIRE )
     {
-        BOOST_FOREACH( DANGLING_END_ITEM item, aItemList )
+        for( DANGLING_END_ITEM item : aItemList )
         {
             if( item.GetItem() == this )
                 continue;
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 20a18b9..753809a 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -54,7 +54,6 @@
 #include <sch_text.h>
 #include <lib_pin.h>
 
-#include <boost/foreach.hpp>
 
 #define EESCHEMA_FILE_STAMP   "EESchema"
 
@@ -493,7 +492,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
                  SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0 )
         return false;
 
-    BOOST_FOREACH( const PART_LIB& lib, *Prj().SchLibs() )
+    for( const PART_LIB& lib : *Prj().SchLibs() )
     {
         if( fprintf( aFile, "LIBS:%s\n", TO_UTF8( lib.GetName() ) ) < 0 )
             return false;
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 33338b7..58b7020 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -162,7 +162,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const
 
     /* Save the list of labels in the sheet. */
 
-    BOOST_FOREACH( const SCH_SHEET_PIN& label, m_pins )
+    for( const SCH_SHEET_PIN& label : m_pins )
     {
         if( !label.Save( aFile ) )
             return false;
@@ -333,12 +333,12 @@ void SCH_SHEET::SwapData( SCH_ITEM* aItem )
 
     // Ensure sheet labels have their .m_Parent member pointing really on their
     // parent, after swapping.
-    BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
+    for( SCH_SHEET_PIN& sheetPin : m_pins )
     {
         sheetPin.SetParent( this );
     }
 
-    BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, sheet->m_pins )
+    for( SCH_SHEET_PIN& sheetPin : sheet->m_pins )
     {
         sheetPin.SetParent( sheet );
     }
@@ -379,7 +379,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
 
 bool SCH_SHEET::HasPin( const wxString& aName )
 {
-    BOOST_FOREACH( SCH_SHEET_PIN pin, m_pins )
+    for( SCH_SHEET_PIN pin : m_pins )
     {
         if( pin.GetText().CmpNoCase( aName ) == 0 )
             return true;
@@ -391,7 +391,7 @@ bool SCH_SHEET::HasPin( const wxString& aName )
 
 bool SCH_SHEET::IsVerticalOrientation() const
 {
-    BOOST_FOREACH( SCH_SHEET_PIN pin, m_pins )
+    for( SCH_SHEET_PIN pin : m_pins )
     {
         if( pin.GetEdge() > 1 )
             return true;
@@ -402,7 +402,7 @@ bool SCH_SHEET::IsVerticalOrientation() const
 
 bool SCH_SHEET::HasUndefinedPins()
 {
-    BOOST_FOREACH( SCH_SHEET_PIN pin, m_pins )
+    for( SCH_SHEET_PIN pin : m_pins )
     {
         /* Search the schematic for a hierarchical label corresponding to this sheet label. */
         EDA_ITEM* DrawStruct  = m_screen->GetDrawItems();
@@ -515,7 +515,7 @@ void SCH_SHEET::CleanupSheet()
 
 SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
 {
-    BOOST_FOREACH( SCH_SHEET_PIN& pin, m_pins )
+    for( SCH_SHEET_PIN& pin : m_pins )
     {
         if( pin.HitTest( aPosition, 0 ) )
             return &pin;
@@ -626,7 +626,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
 
 
     /* Draw text : SheetLabel */
-    BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
+    for( SCH_SHEET_PIN& sheetPin : m_pins )
     {
         if( !sheetPin.IsMoving() )
             sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor );
@@ -862,7 +862,7 @@ void SCH_SHEET::Rotate(wxPoint aPosition)
         m_size.y = -m_size.y;
     }
 
-    BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
+    for( SCH_SHEET_PIN& sheetPin : m_pins )
     {
         sheetPin.Rotate( aPosition );
     }
@@ -874,7 +874,7 @@ void SCH_SHEET::MirrorX( int aXaxis_position )
     MIRROR( m_pos.y, aXaxis_position );
     m_pos.y -= m_size.y;
 
-    BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
+    for( SCH_SHEET_PIN& sheetPin : m_pins )
     {
         sheetPin.MirrorX( aXaxis_position );
     }
@@ -886,7 +886,7 @@ void SCH_SHEET::MirrorY( int aYaxis_position )
     MIRROR( m_pos.x, aYaxis_position );
     m_pos.x -= m_size.x;
 
-    BOOST_FOREACH( SCH_SHEET_PIN& label, m_pins )
+    for( SCH_SHEET_PIN& label : m_pins )
     {
         label.MirrorY( aYaxis_position );
     }
@@ -909,7 +909,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
     m_size = aSize;
 
     /* Move the sheet labels according to the new sheet size. */
-    BOOST_FOREACH( SCH_SHEET_PIN& label, m_pins )
+    for( SCH_SHEET_PIN& label : m_pins )
     {
         label.ConstrainOnEdge( label.GetPosition() );
     }
@@ -952,7 +952,7 @@ void SCH_SHEET::renumberPins()
 {
     int id = 2;
 
-    BOOST_FOREACH( SCH_SHEET_PIN& pin, m_pins )
+    for( SCH_SHEET_PIN& pin : m_pins )
     {
         pin.SetNumber( id );
         id++;
@@ -978,7 +978,7 @@ bool SCH_SHEET::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemL
 {
     bool currentState = IsDangling();
 
-    BOOST_FOREACH( SCH_SHEET_PIN& pinsheet, GetPins() )
+    for( SCH_SHEET_PIN& pinsheet : GetPins() )
     {
         pinsheet.IsDanglingStateChanged( aItemList );
     }
@@ -1212,7 +1212,7 @@ SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
 
         // Ensure sheet labels have their #m_Parent member pointing really on their
         // parent, after assigning.
-        BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
+        for( SCH_SHEET_PIN& sheetPin : m_pins )
         {
             sheetPin.SetParent( this );
         }
@@ -1233,7 +1233,7 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
                                  << TO_UTF8( m_name ) << '"' << ">\n";
 
     // show all the pins, and check the linked list integrity
-    BOOST_FOREACH( const SCH_SHEET_PIN& label, m_pins )
+    for( const SCH_SHEET_PIN& label : m_pins )
     {
         label.Show( nestLevel + 1, os );
     }
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 2629ec0..ddb7e79 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -31,7 +31,6 @@
 #define SCH_SHEEET_H
 
 #include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/foreach.hpp>
 #include <sch_text.h>
 
 
@@ -505,7 +504,7 @@ public:
     {
         m_pos += aMoveVector;
 
-        BOOST_FOREACH( SCH_SHEET_PIN& pin, m_pins )
+        for( SCH_SHEET_PIN& pin : m_pins )
         {
             pin.Move( aMoveVector );
         }
diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp
index 9938555..74023b0 100644
--- a/eeschema/sch_sheet_path.cpp
+++ b/eeschema/sch_sheet_path.cpp
@@ -43,7 +43,6 @@
 
 #include <dialogs/dialog_schematic_find.h>
 
-#include <boost/foreach.hpp>
 #include <wx/filename.h>
 
 
@@ -586,7 +585,7 @@ void SCH_SHEET_LIST::GetMultiUnitComponents( PART_LIBS* aLibs,
         SCH_MULTI_UNIT_REFERENCE_MAP tempMap;
         (*it).GetMultiUnitComponents( aLibs, tempMap );
 
-        BOOST_FOREACH( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair, tempMap )
+        for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : tempMap )
         {
             // Merge this list into the main one
             unsigned n_refs = pair.second.GetCount();
diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp
index fd5b4eb..a36a4d2 100644
--- a/eeschema/symbedit.cpp
+++ b/eeschema/symbedit.cpp
@@ -42,8 +42,6 @@
 #include <class_library.h>
 #include <wildcards_and_files_ext.h>
 
-#include <boost/foreach.hpp>
-
 
 void LIB_EDIT_FRAME::LoadOneSymbol()
 {
@@ -114,7 +112,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
     LIB_PART*   first = lib->GetFirstEntry()->GetPart();
     LIB_ITEMS&  drawList = first->GetDrawItemList();
 
-    BOOST_FOREACH( LIB_ITEM& item, drawList )
+    for( LIB_ITEM& item : drawList )
     {
         if( item.Type() == LIB_FIELD_T )
             continue;
@@ -217,7 +215,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
 
             LIB_ITEMS& drawList = part->GetDrawItemList();
 
-            BOOST_FOREACH( LIB_ITEM& item, drawList )
+            for( LIB_ITEM& item : drawList )
             {
                 if( item.Type() == LIB_FIELD_T )
                     continue;
diff --git a/include/footprint_info.h b/include/footprint_info.h
index 7af63e4..2559752 100644
--- a/include/footprint_info.h
+++ b/include/footprint_info.h
@@ -31,7 +31,6 @@
 
 
 #include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/foreach.hpp>
 
 #include <ki_mutex.h>
 #include <kicad_string.h>
diff --git a/pcbnew/autorouter/spread_footprints.cpp b/pcbnew/autorouter/spread_footprints.cpp
index 15519f3..e67e5c0 100644
--- a/pcbnew/autorouter/spread_footprints.cpp
+++ b/pcbnew/autorouter/spread_footprints.cpp
@@ -35,7 +35,6 @@
  */
 
 #include <algorithm>
-#include <boost/foreach.hpp>
 
 #include <fctsys.h>
 #include <convert_to_biu.h>
@@ -194,7 +193,7 @@ void PCB_EDIT_FRAME::SpreadFootprints( std::vector<MODULE*>* aFootprints,
     // calculate also the area needed by these footprints
     std::vector <MODULE*> footprintList;
 
-    BOOST_FOREACH( MODULE* footprint, *aFootprints )
+    for( MODULE* footprint : *aFootprints )
     {
         footprint->CalculateBoundingBox();
 
@@ -221,7 +220,7 @@ void PCB_EDIT_FRAME::SpreadFootprints( std::vector<MODULE*>* aFootprints,
     undoList.m_Status = UR_CHANGED;
     ITEM_PICKER        picker( NULL, UR_CHANGED );
 
-    BOOST_FOREACH( MODULE* footprint, footprintList )
+    for( MODULE* footprint : footprintList )
     {
         // Undo: add copy of the footprint to undo list
         picker.SetItem( footprint );
diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp
index f2cd0cf..a5129cc 100644
--- a/pcbnew/class_pad.cpp
+++ b/pcbnew/class_pad.cpp
@@ -42,7 +42,6 @@
 #include <class_module.h>
 #include <polygon_test_point_inside.h>
 #include <convert_to_biu.h>
-#include <boost/foreach.hpp>
 #include <convert_basic_shapes_to_polygon.h>
 
 
@@ -976,7 +975,7 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
     static const LAYER_ID layers_mech[] = { F_Mask, B_Mask, F_Paste, B_Paste,
         F_Adhes, B_Adhes, F_SilkS, B_SilkS, Dwgs_User, Eco1_User, Eco2_User };
 
-    BOOST_FOREACH( LAYER_ID each_layer, layers_mech )
+    for( LAYER_ID each_layer : layers_mech )
     {
         if( IsOnLayer( each_layer ) )
             aLayers[aCount++] = each_layer;
diff --git a/pcbnew/dialogs/dialog_update_pcb.cpp b/pcbnew/dialogs/dialog_update_pcb.cpp
index 3a399f0..280232d 100644
--- a/pcbnew/dialogs/dialog_update_pcb.cpp
+++ b/pcbnew/dialogs/dialog_update_pcb.cpp
@@ -112,7 +112,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun )
 
         if( !newFootprints.empty() )
         {
-            BOOST_FOREACH( MODULE* footprint, newFootprints )
+            for( MODULE* footprint : newFootprints )
             {
                 toolManager->RunAction( COMMON_ACTIONS::selectItem, true, footprint );
             }
diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp
index c5b3174..2693cde 100644
--- a/pcbnew/modview_frame.cpp
+++ b/pcbnew/modview_frame.cpp
@@ -393,7 +393,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
         return;
     }
 
-    BOOST_FOREACH( const FOOTPRINT_INFO& footprint, fp_info_list.GetList() )
+    for( const FOOTPRINT_INFO& footprint : fp_info_list.GetList() )
     {
         m_footprintList->Append( footprint.GetFootprintName() );
     }
diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp
index 96b4e8b..a0792d8 100644
--- a/pcbnew/netlist.cpp
+++ b/pcbnew/netlist.cpp
@@ -125,7 +125,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
         SpreadFootprints( &newFootprints, false, false );
         if( !newFootprints.empty() )
         {
-            BOOST_FOREACH( MODULE* footprint, newFootprints )
+            for( MODULE* footprint : newFootprints )
             {
                 m_toolManager->RunAction( COMMON_ACTIONS::selectItem, true, footprint );
             }
diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp
index 04d379a..7123783 100644
--- a/pcbnew/ratsnest_data.cpp
+++ b/pcbnew/ratsnest_data.cpp
@@ -129,7 +129,7 @@ static std::vector<RN_EDGE_MST_PTR>* kruskalMST( RN_LINKS::RN_EDGE_LIST& aEdges,
     // Set tags for marking cycles
     boost::unordered_map<RN_NODE_PTR, int> tags;
     unsigned int tag = 0;
-    BOOST_FOREACH( RN_NODE_PTR& node, aNodes )
+    for( RN_NODE_PTR& node : aNodes )
     {
         node->SetTag( tag );
         tags[node] = tag++;
@@ -220,7 +220,7 @@ void RN_NET::validateEdge( RN_EDGE_MST_PTR& aEdge )
         valid = false;
 
         std::list<RN_NODE_PTR> closest = GetClosestNodes( source, WITHOUT_FLAG() );
-        BOOST_FOREACH( RN_NODE_PTR& node, closest )
+        for( RN_NODE_PTR& node : closest )
         {
             if( node && node != target )
             {
@@ -235,7 +235,7 @@ void RN_NET::validateEdge( RN_EDGE_MST_PTR& aEdge )
         valid = false;
 
         std::list<RN_NODE_PTR> closest = GetClosestNodes( target, WITHOUT_FLAG() );
-        BOOST_FOREACH( RN_NODE_PTR& node, closest )
+        for( RN_NODE_PTR& node : closest )
         {
             if( node && node != source )
             {
@@ -343,7 +343,7 @@ void RN_NET::compute()
         }
 
         // Set tags to nodes as connected
-        BOOST_FOREACH( RN_NODE_PTR node, boardNodes )
+        for( RN_NODE_PTR node : boardNodes )
             node->SetTag( 0 );
 
         return;
@@ -418,7 +418,7 @@ void RN_NET::Update()
 
     compute();
 
-    BOOST_FOREACH( RN_EDGE_MST_PTR& edge, *m_rnEdges )
+    for( RN_EDGE_MST_PTR& edge : *m_rnEdges )
         validateEdge( edge );
 
     m_dirty = false;
@@ -492,7 +492,7 @@ void RN_NET::RemoveItem( const D_PAD* aPad )
     RN_PAD_DATA& pad_data = it->second;
     removeNode( pad_data.m_Node, aPad );
 
-    BOOST_FOREACH( RN_EDGE_MST_PTR& edge, pad_data.m_Edges )
+    for( RN_EDGE_MST_PTR& edge : pad_data.m_Edges )
         removeEdge( edge, aPad );
 
     m_pads.erase( aPad );
@@ -534,13 +534,13 @@ void RN_NET::RemoveItem( const ZONE_CONTAINER* aZone )
 
     // Remove all subpolygons that make the zone
     std::deque<RN_POLY>& polygons = zoneData.m_Polygons;
-    BOOST_FOREACH( RN_POLY& polygon, polygons )
+    for( RN_POLY& polygon : polygons )
         removeNode( polygon.GetNode(), aZone );
     polygons.clear();
 
     // Remove all connections added by the zone
     std::deque<RN_EDGE_MST_PTR>& edges = zoneData.m_Edges;
-    BOOST_FOREACH( RN_EDGE_MST_PTR edge, edges )
+    for( RN_EDGE_MST_PTR edge : edges )
         removeEdge( edge, aZone );
     edges.clear();
 
@@ -614,7 +614,7 @@ std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode, int aN
     const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
 
     // Copy nodes
-    BOOST_FOREACH( const RN_NODE_PTR& node, nodes )
+    for( const RN_NODE_PTR& node : nodes )
         closest.push_back( node );
 
     // Sort by the distance from aNode
@@ -638,7 +638,7 @@ std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode,
     const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
 
     // Copy nodes
-    BOOST_FOREACH( const RN_NODE_PTR& node, nodes )
+    for( const RN_NODE_PTR& node : nodes )
         closest.push_back( node );
 
     // Sort by the distance from aNode
@@ -660,7 +660,7 @@ std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode,
 
 void RN_NET::AddSimple( const BOARD_CONNECTED_ITEM* aItem )
 {
-    BOOST_FOREACH( RN_NODE_PTR node, GetNodes( aItem ) )
+    for( RN_NODE_PTR node : GetNodes( aItem ) )
     {
         // Block all nodes, so they do not become targets for dynamic ratsnest lines
         AddBlockedNode( node );
@@ -734,25 +734,25 @@ void RN_NET::GetAllItems( std::list<BOARD_CONNECTED_ITEM*>& aOutput, RN_ITEM_TYP
 {
     if( aType & RN_PADS )
     {
-        BOOST_FOREACH( const BOARD_CONNECTED_ITEM* item, m_pads | boost::adaptors::map_keys )
+        for( const BOARD_CONNECTED_ITEM* item : m_pads | boost::adaptors::map_keys )
             aOutput.push_back( const_cast<BOARD_CONNECTED_ITEM*>( item ) );
     }
 
     if( aType & RN_VIAS )
     {
-        BOOST_FOREACH( const BOARD_CONNECTED_ITEM* item, m_vias | boost::adaptors::map_keys )
+        for( const BOARD_CONNECTED_ITEM* item : m_vias | boost::adaptors::map_keys )
             aOutput.push_back( const_cast<BOARD_CONNECTED_ITEM*>( item ) );
     }
 
     if( aType & RN_TRACKS )
     {
-        BOOST_FOREACH( const BOARD_CONNECTED_ITEM* item, m_tracks | boost::adaptors::map_keys )
+        for( const BOARD_CONNECTED_ITEM* item : m_tracks | boost::adaptors::map_keys )
             aOutput.push_back( const_cast<BOARD_CONNECTED_ITEM*>( item ) );
     }
 
     if( aType & RN_ZONES )
     {
-        BOOST_FOREACH( const BOARD_CONNECTED_ITEM* item, m_zones | boost::adaptors::map_keys )
+        for( const BOARD_CONNECTED_ITEM* item : m_zones | boost::adaptors::map_keys )
             aOutput.push_back( const_cast<BOARD_CONNECTED_ITEM*>( item ) );
     }
 }
@@ -760,7 +760,7 @@ void RN_NET::GetAllItems( std::list<BOARD_CONNECTED_ITEM*>& aOutput, RN_ITEM_TYP
 
 void RN_NET::ClearSimple()
 {
-    BOOST_FOREACH( const RN_NODE_PTR& node, m_blockedNodes )
+    for( const RN_NODE_PTR& node : m_blockedNodes )
         node->SetFlag( false );
 
     m_blockedNodes.clear();
@@ -809,7 +809,7 @@ void RN_NET::GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem,
     {
         for( ZONE_DATA_MAP::const_iterator it = m_zones.begin(); it != m_zones.end(); ++it )
         {
-            BOOST_FOREACH( const RN_EDGE_MST_PTR& edge, it->second.m_Edges )
+            for( const RN_EDGE_MST_PTR& edge : it->second.m_Edges )
             {
                 if( edge->GetTag() == tag )
                 {
@@ -863,7 +863,7 @@ void RN_DATA::AddBlocked( const BOARD_ITEM* aItem )
             return;
 
         // Block all nodes belonging to the item
-        BOOST_FOREACH( RN_NODE_PTR node, m_nets[net].GetNodes( item ) )
+        for( RN_NODE_PTR node : m_nets[net].GetNodes( item ) )
             m_nets[net].AddBlockedNode( node );
     }
     else if( aItem->Type() == PCB_MODULE_T )
@@ -951,7 +951,7 @@ void RN_NET::processZones()
         RN_ZONE_DATA& zoneData = it->second;
 
         // Reset existing connections
-        BOOST_FOREACH( RN_EDGE_MST_PTR edge, zoneData.m_Edges )
+        for( RN_EDGE_MST_PTR edge : zoneData.m_Edges )
             m_links.RemoveConnection( edge );
 
         zoneData.m_Edges.clear();
@@ -1006,7 +1006,7 @@ void RN_NET::processPads()
         std::deque<RN_EDGE_MST_PTR>& edges = it->second.m_Edges;
 
         // Reset existing connections
-        BOOST_FOREACH( RN_EDGE_MST_PTR edge, edges )
+        for( RN_EDGE_MST_PTR edge : edges )
             m_links.RemoveConnection( edge );
 
         LSET layers = pad->GetLayerSet();
diff --git a/pcbnew/ratsnest_data.h b/pcbnew/ratsnest_data.h
index ec996ba..bfb919e 100644
--- a/pcbnew/ratsnest_data.h
+++ b/pcbnew/ratsnest_data.h
@@ -37,7 +37,6 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/foreach.hpp>
 
 #include <deque>
 
@@ -687,7 +686,7 @@ public:
      */
     void ClearSimple()
     {
-        BOOST_FOREACH( RN_NET& net, m_nets )
+        for( RN_NET& net : m_nets )
             net.ClearSimple();
     }
 
diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp
index d31c0bd..a2b6c89 100644
--- a/pcbnew/ratsnest_viewitem.cpp
+++ b/pcbnew/ratsnest_viewitem.cpp
@@ -33,7 +33,6 @@
 #include <pcb_painter.h>
 #include <layers_id_colors_and_visibility.h>
 
-#include <boost/foreach.hpp>
 
 namespace KIGFX {
 
@@ -74,7 +73,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
         aGal->SetStrokeColor( color.Brightened( 0.8 ) );
 
         // Draw the "dynamic" ratsnest (i.e. for objects that may be currently being moved)
-        BOOST_FOREACH( const RN_NODE_PTR& node, net.GetSimpleNodes() )
+        for( const RN_NODE_PTR& node : net.GetSimpleNodes() )
         {
             // Skipping nodes with higher reference count avoids displaying redundant lines
             if( node->GetRefCount() > 1 )
@@ -100,7 +99,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
         if( edges == NULL )
             continue;
 
-        BOOST_FOREACH( const RN_EDGE_MST_PTR& edge, *edges )
+        for( const RN_EDGE_MST_PTR& edge : *edges )
         {
             const RN_NODE_PTR& sourceNode = edge->GetSourceNode();
             const RN_NODE_PTR& targetNode = edge->GetTargetNode();
diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp
index 5f53e62..e2f56c0 100644
--- a/pcbnew/router/length_tuner_tool.cpp
+++ b/pcbnew/router/length_tuner_tool.cpp
@@ -18,7 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
 #include "class_draw_panel_gal.h"
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 9265430..a6cedda 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include <cstdio>
 #include <cstdlib>
 #include <cmath>
@@ -281,7 +279,7 @@ const PNS_DIFF_PAIR PNS_DP_GATEWAY::Entry() const
 void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries,
         const VECTOR2I& aCursorPos, int aOrthoScore )
 {
-    BOOST_FOREACH( PNS_DP_GATEWAY g, aEntries.Gateways() )
+    for( PNS_DP_GATEWAY g : aEntries.Gateways() )
     {
         VECTOR2I midpoint( ( g.AnchorP() + g.AnchorN() ) / 2 );
         SEG guide_s( midpoint, midpoint + VECTOR2I( 1, 0 ) );
@@ -304,7 +302,7 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries,
 
         targets.BuildForCursor( proj );
 
-        BOOST_FOREACH( PNS_DP_GATEWAY t, targets.Gateways() )
+        for( PNS_DP_GATEWAY t : targets.Gateways() )
         {
             t.SetPriority( aOrthoScore );
             m_gateways.push_back( t );
@@ -318,9 +316,9 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
 {
     std::vector<DP_CANDIDATE> candidates;
 
-    BOOST_FOREACH( PNS_DP_GATEWAY g_entry, aEntry.Gateways() )
+    for( PNS_DP_GATEWAY g_entry : aEntry.Gateways() )
     {
-        BOOST_FOREACH( PNS_DP_GATEWAY g_target, aTarget.Gateways() )
+        for( PNS_DP_GATEWAY g_target : aTarget.Gateways() )
         {
             for( int attempt = 0; attempt < 2; attempt++ )
             {
@@ -346,7 +344,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
     DP_CANDIDATE best;
     bool found = false;
 
-    BOOST_FOREACH( DP_CANDIDATE c, candidates )
+    for( DP_CANDIDATE c : candidates )
     {
         if( c.score > bestScore )
         {
@@ -530,7 +528,7 @@ void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos )
 
 void PNS_DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n )
 {
-    BOOST_FOREACH( PNS_DP_GATEWAY &g, m_gateways )
+    for( PNS_DP_GATEWAY &g : m_gateways )
     {
         if( !g.HasEntryLines() )
         {
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 322cd33..9711ed6 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -18,7 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
 #include <colors.h>
@@ -532,7 +531,7 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
     double bestDist = std::numeric_limits<double>::max();
     bool found = false;
 
-    BOOST_FOREACH( PNS_ITEM* item, items )
+    for( PNS_ITEM* item : items )
     {
         if( item->Kind() == aItem->Kind() )
         {
diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp
index 5179e19..258cca8 100644
--- a/pcbnew/router/pns_dp_meander_placer.cpp
+++ b/pcbnew/router/pns_dp_meander_placer.cpp
@@ -18,7 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
 #include <base_units.h> // God forgive me doing this...
@@ -128,14 +127,14 @@ int PNS_DP_MEANDER_PLACER::origPathLength() const
     int totalP = 0;
     int totalN = 0;
 
-    BOOST_FOREACH( const PNS_ITEM* item, m_tunedPathP.CItems() )
+    for( const PNS_ITEM* item : m_tunedPathP.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
             totalP += l->CLine().Length();
 
     }
 
-    BOOST_FOREACH( const PNS_ITEM* item, m_tunedPathN.CItems() )
+    for( const PNS_ITEM* item : m_tunedPathN.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
             totalN += l->CLine().Length();
@@ -206,13 +205,13 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
 
     m_result.SetBaselineOffset( offset );
 
-    BOOST_FOREACH( const PNS_ITEM* item, m_tunedPathP.CItems() )
+    for( const PNS_ITEM* item : m_tunedPathP.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
             Router()->DisplayDebugLine( l->CLine(), 5, 10000 );
     }
 
-    BOOST_FOREACH( const PNS_ITEM* item, m_tunedPathN.CItems() )
+    for( const PNS_ITEM* item : m_tunedPathN.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
             Router()->DisplayDebugLine( l->CLine(), 5, 10000 );
@@ -220,7 +219,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
 
     int curIndexP = 0, curIndexN = 0;
 
-    BOOST_FOREACH( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& sp, coupledSegments )
+    for( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& sp : coupledSegments )
     {
         SEG base = baselineSegment( sp );
 
@@ -267,7 +266,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
         tunedP.Clear();
         tunedN.Clear();
 
-        BOOST_FOREACH( PNS_MEANDER_SHAPE* m, m_result.Meanders() )
+        for( PNS_MEANDER_SHAPE* m : m_result.Meanders() )
         {
             if( m->Type() != MT_EMPTY )
             {
diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp
index a30e7cd..65b2e23 100644
--- a/pcbnew/router/pns_dragger.cpp
+++ b/pcbnew/router/pns_dragger.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include "pns_dragger.h"
 #include "pns_shove.h"
 #include "pns_router.h"
@@ -86,7 +84,7 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
     if( !jt )
         return false;
 
-    BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
+    for( PNS_ITEM* item : jt->LinkList() )
     {
         if( item->OfKind( PNS_ITEM::SEGMENT ) )
         {
@@ -193,7 +191,7 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a
     m_lastNode->Remove( aVia );
     m_lastNode->Add( m_draggedVia );
 
-    BOOST_FOREACH( PNS_ITEM* item, m_origViaConnections.Items() )
+    for( PNS_ITEM* item : m_origViaConnections.Items() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
         {
diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h
index 6c895dc..abeeb61 100644
--- a/pcbnew/router/pns_index.h
+++ b/pcbnew/router/pns_index.h
@@ -24,7 +24,6 @@
 #include <layers_id_colors_and_visibility.h>
 #include <map>
 
-#include <boost/foreach.hpp>
 #include <boost/range/adaptor/map.hpp>
 
 #include <list>
diff --git a/pcbnew/router/pns_itemset.cpp b/pcbnew/router/pns_itemset.cpp
index 06561a7..dc7b12c 100644
--- a/pcbnew/router/pns_itemset.cpp
+++ b/pcbnew/router/pns_itemset.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include "pns_itemset.h"
 #include "pns_line.h"
 
@@ -53,7 +51,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
     else
         l = PNS_LAYERSET( aStart, aEnd );
 
-    BOOST_FOREACH( const ENTRY& ent, m_items )
+    for( const ENTRY& ent : m_items )
     {
         if( ent.item->Layers().Overlaps( l ) ^ aInvert )
         {
@@ -71,7 +69,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
 {
     ENTRIES newItems;
 
-    BOOST_FOREACH( const ENTRY& ent, m_items )
+    for( const ENTRY& ent : m_items )
     {
         if( ent.item->OfKind( aKindMask ) ^ aInvert )
         {
@@ -89,7 +87,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert )
 {
     ENTRIES newItems;
 
-    BOOST_FOREACH( const ENTRY& ent, m_items )
+    for( const ENTRY& ent : m_items )
     {
         if( ent.item->Marker() & aMarker )
         {
@@ -107,7 +105,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
 {
     ENTRIES newItems;
 
-    BOOST_FOREACH( const ENTRY& ent, m_items )
+    for( const ENTRY& ent : m_items )
     {
         if( ( ent.item->Net() == aNet ) ^ aInvert )
         {
@@ -125,7 +123,7 @@ PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem )
 {
     ENTRIES newItems;
 
-    BOOST_FOREACH( const ENTRY& ent, m_items )
+    for( const ENTRY& ent : m_items )
     {
         if( ent.item != aItem )
 
diff --git a/pcbnew/router/pns_itemset.h b/pcbnew/router/pns_itemset.h
index 728d0ae..e39a654 100644
--- a/pcbnew/router/pns_itemset.h
+++ b/pcbnew/router/pns_itemset.h
@@ -22,7 +22,6 @@
 #define __PNS_ITEMSET_H
 
 #include <vector>
-#include <boost/foreach.hpp>
 
 #include "pns_item.h"
 
@@ -118,7 +117,7 @@ public:
     {
         int n = 0;
 
-        BOOST_FOREACH( PNS_ITEM* item, m_items )
+        for( PNS_ITEM* item : m_items )
         {
             if( item->Kind() & aKindMask )
                 n++;
@@ -205,7 +204,7 @@ public:
     {
         int n = 0;
 
-        BOOST_FOREACH( const PNS_ITEM* item, m_items )
+        for( const PNS_ITEM* item : m_items )
         {
             if( item->OfKind( kind ) )
             {
diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h
index eab4a56..e3aef65 100644
--- a/pcbnew/router/pns_joint.h
+++ b/pcbnew/router/pns_joint.h
@@ -145,7 +145,7 @@ public:
 
     PNS_VIA* Via()
     {
-        BOOST_FOREACH( PNS_ITEM* item, m_linkedItems.Items() )
+        for( PNS_ITEM* item : m_linkedItems.Items() )
         {
             if( item->OfKind( VIA ) )
                 return static_cast<PNS_VIA*>( item );
@@ -208,7 +208,7 @@ public:
         if( aJoint.IsLocked() )
             m_locked = true;
 
-        BOOST_FOREACH( PNS_ITEM* item, aJoint.LinkList() )
+        for( PNS_ITEM* item : aJoint.LinkList() )
         {
             m_linkedItems.Add( item );
         }
diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp
index 9e50260..b823641 100644
--- a/pcbnew/router/pns_line.cpp
+++ b/pcbnew/router/pns_line.cpp
@@ -18,7 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
 #include <math/vector2d.h>
@@ -88,7 +87,7 @@ void PNS_LINE::Mark( int aMarker )
 
     if( m_segmentRefs )
     {
-        BOOST_FOREACH( PNS_SEGMENT* s, *m_segmentRefs )
+        for( PNS_SEGMENT* s : *m_segmentRefs )
             s->Mark( aMarker );
     }
 }
@@ -98,7 +97,7 @@ void PNS_LINE::Unmark()
 {
     if( m_segmentRefs )
     {
-        BOOST_FOREACH( PNS_SEGMENT* s, *m_segmentRefs )
+        for( PNS_SEGMENT* s : *m_segmentRefs )
             s->Unmark();
     }
 
@@ -112,7 +111,7 @@ int PNS_LINE::Marker() const
 
     if( m_segmentRefs )
     {
-        BOOST_FOREACH( PNS_SEGMENT* s, *m_segmentRefs )
+        for( PNS_SEGMENT* s : *m_segmentRefs )
         {
             marker |= s->Marker();
         }
@@ -734,7 +733,7 @@ void PNS_LINE::SetRank( int aRank )
 
     if( m_segmentRefs )
     {
-        BOOST_FOREACH( PNS_SEGMENT* s, *m_segmentRefs )
+        for( PNS_SEGMENT* s : *m_segmentRefs )
             s->SetRank( aRank );
     }
 }
@@ -747,7 +746,7 @@ int PNS_LINE::Rank() const
 
     if( m_segmentRefs )
     {
-        BOOST_FOREACH( PNS_SEGMENT *s, *m_segmentRefs )
+        for( PNS_SEGMENT *s : *m_segmentRefs )
             min_rank = std::min( min_rank, s->Rank() );
         rank = ( min_rank == INT_MAX ) ? -1 : min_rank;
     }
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 7f4efb4..7f7f510 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -18,7 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
 #include <colors.h>
@@ -121,7 +120,7 @@ bool PNS_LINE_PLACER::handleSelfIntersections()
 
     // if there is more than one intersection, find the one that is
     // closest to the beginning of the tail.
-    BOOST_FOREACH( SHAPE_LINE_CHAIN::INTERSECTION i, ips )
+    for( SHAPE_LINE_CHAIN::INTERSECTION i : ips )
     {
         if( i.our.Index() < n )
         {
@@ -971,13 +970,13 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest )
         int removedCount = 0;
         int total = 0;
 
-        BOOST_FOREACH( PNS_LINE& line, lines )
+        for( PNS_LINE& line : lines )
         {
             total++;
 
             if( !( line.ContainsSegment( seg ) ) && line.SegmentCount() )
             {
-                BOOST_FOREACH( PNS_SEGMENT *ss, *line.LinkedSegments() )
+                for( PNS_SEGMENT *ss : *line.LinkedSegments() )
                     toErase.insert( ss );
 
                 removedCount++;
@@ -987,7 +986,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest )
         TRACE( 0, "total segs removed: %d/%d\n", removedCount % total );
     }
 
-    BOOST_FOREACH( PNS_SEGMENT *s, toErase )
+    for( PNS_SEGMENT *s : toErase )
         aNode->Remove( s );
 
     aNode->Remove( &aLatest );
diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp
index 6739401..2252d9f 100644
--- a/pcbnew/router/pns_meander.cpp
+++ b/pcbnew/router/pns_meander.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include <base_units.h> // God forgive me doing this...
 #include <colors.h>
 
@@ -578,7 +576,7 @@ void PNS_MEANDERED_LINE::AddMeander( PNS_MEANDER_SHAPE* aShape )
 
 void PNS_MEANDERED_LINE::Clear()
 {
-    BOOST_FOREACH( PNS_MEANDER_SHAPE* m, m_meanders )
+    for( PNS_MEANDER_SHAPE* m : m_meanders )
     {
         delete m;
     }
diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp
index 14b9f9b..a71b312 100644
--- a/pcbnew/router/pns_meander_placer.cpp
+++ b/pcbnew/router/pns_meander_placer.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include <base_units.h> // God forgive me doing this...
 #include <colors.h>
 
@@ -94,7 +92,7 @@ bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
 int PNS_MEANDER_PLACER::origPathLength() const
 {
     int total = 0;
-    BOOST_FOREACH( const PNS_ITEM* item, m_tunedPath.CItems() )
+    for( const PNS_ITEM* item : m_tunedPath.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
         {
@@ -148,7 +146,7 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa
         tuneLineLength( m_result, aTargetLength - lineLen );
     }
 
-    BOOST_FOREACH ( const PNS_ITEM* item, m_tunedPath.CItems() )
+    for( const PNS_ITEM* item : m_tunedPath.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
         {
@@ -160,7 +158,7 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa
     {
         tuned.Clear();
 
-        BOOST_FOREACH( PNS_MEANDER_SHAPE* m, m_result.Meanders() )
+        for( PNS_MEANDER_SHAPE* m : m_result.Meanders() )
         {
             if( m->Type() != MT_EMPTY )
             {
diff --git a/pcbnew/router/pns_meander_placer_base.cpp b/pcbnew/router/pns_meander_placer_base.cpp
index 0a655e4..bb15451 100644
--- a/pcbnew/router/pns_meander_placer_base.cpp
+++ b/pcbnew/router/pns_meander_placer_base.cpp
@@ -108,7 +108,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
     int remaining = aElongation;
     bool finished = false;
 
-    BOOST_FOREACH( PNS_MEANDER_SHAPE* m, aTuned.Meanders() )
+    for( PNS_MEANDER_SHAPE* m : aTuned.Meanders() )
     {
         if( m->Type() != MT_CORNER )
         {
@@ -140,7 +140,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
     remaining = aElongation;
     int meanderCount = 0;
 
-    BOOST_FOREACH(PNS_MEANDER_SHAPE* m, aTuned.Meanders())
+    for(PNS_MEANDER_SHAPE* m : aTuned.Meanders())
     {
         if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
         {
@@ -159,7 +159,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
 
     if( balance >= 0 )
     {
-        BOOST_FOREACH( PNS_MEANDER_SHAPE* m, aTuned.Meanders() )
+        for( PNS_MEANDER_SHAPE* m : aTuned.Meanders() )
         {
             if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
             {
diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp
index 3d4626d..ed18642 100644
--- a/pcbnew/router/pns_meander_skew_placer.cpp
+++ b/pcbnew/router/pns_meander_skew_placer.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include <base_units.h> // God forgive me doing this...
 #include <colors.h>
 
@@ -110,7 +108,7 @@ int PNS_MEANDER_SKEW_PLACER::origPathLength( ) const
 int PNS_MEANDER_SKEW_PLACER::itemsetLength( const PNS_ITEMSET& aSet ) const
 {
     int total = 0;
-    BOOST_FOREACH( const PNS_ITEM* item, aSet.CItems() )
+    for( const PNS_ITEM* item : aSet.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
         {
@@ -130,13 +128,13 @@ int PNS_MEANDER_SKEW_PLACER::currentSkew() const
 
 bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
 {
-	BOOST_FOREACH( const PNS_ITEM* item, m_tunedPathP.CItems() )
+	for( const PNS_ITEM* item : m_tunedPathP.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
             Router()->DisplayDebugLine( l->CLine(), 5, 10000 );
     }
 
-    BOOST_FOREACH( const PNS_ITEM* item, m_tunedPathN.CItems() )
+    for( const PNS_ITEM* item : m_tunedPathN.CItems() )
     {
         if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
             Router()->DisplayDebugLine( l->CLine(), 4, 10000 );
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index 3f9bf12..30355a8 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -305,7 +305,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle(   const PNS_LINE* aItem,
     nearest.m_item = NULL;
     nearest.m_distFirst = INT_MAX;
 
-    BOOST_FOREACH( PNS_OBSTACLE obs, obs_list )
+    for( PNS_OBSTACLE obs : obs_list )
     {
         VECTOR2I ip_first, ip_last;
         int dist_max = INT_MIN;
@@ -327,7 +327,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle(   const PNS_LINE* aItem,
 
             viaHull.Intersect( hull, isect_list );
 
-            BOOST_FOREACH( SHAPE_LINE_CHAIN::INTERSECTION isect, isect_list )
+            for( SHAPE_LINE_CHAIN::INTERSECTION isect : isect_list )
             {
                 int dist = aLine.CLine().Length() +
                            ( isect.p - aLine.Via().Pos() ).EuclideanNorm();
@@ -353,7 +353,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle(   const PNS_LINE* aItem,
 
         hull.Intersect( aLine.CLine(), isect_list );
 
-        BOOST_FOREACH( SHAPE_LINE_CHAIN::INTERSECTION isect, isect_list )
+        for( SHAPE_LINE_CHAIN::INTERSECTION isect : isect_list )
         {
             int dist = aLine.CLine().PathLength( isect.p );
 
@@ -386,7 +386,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle(   const PNS_LINE* aItem,
 
 PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEMSET& aSet, int aKindMask )
 {
-    BOOST_FOREACH( const PNS_ITEM* item, aSet.CItems() )
+    for( const PNS_ITEM* item : aSet.CItems() )
     {
         OPT_OBSTACLE obs = CheckColliding( item, aKindMask );
 
@@ -493,7 +493,7 @@ const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const
         HIT_VISITOR  visitor_root( items_root, aPoint, m_root );
         m_root->m_index->Query( &s, m_maxClearance, visitor_root );
 
-        BOOST_FOREACH( PNS_ITEM* item, items_root.Items() )
+        for( PNS_ITEM* item : items_root.Items() )
         {
             if( !overrides( item ) )
                 items.Add( item );
@@ -640,7 +640,7 @@ void PNS_NODE::removeLine( PNS_LINE* aLine )
 
     assert( segRefs != NULL );
 
-    BOOST_FOREACH( PNS_SEGMENT* seg, *segRefs )
+    for( PNS_SEGMENT* seg : *segRefs )
     {
         removeSegment( seg );
     }
@@ -686,7 +686,7 @@ void PNS_NODE::removeVia( PNS_VIA* aVia )
     } while( split );
 
     // and re-link them, using the former via's link list
-    BOOST_FOREACH(PNS_ITEM* item, links)
+    for(PNS_ITEM* item : links)
     {
         if( item != aVia )
             linkJoint ( p, item->Layers(), net, item );
@@ -852,7 +852,7 @@ void PNS_NODE::MapConnectivity ( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFo
         PNS_JOINT* current = searchQueue.front();
         searchQueue.pop_front();
 
-        BOOST_FOREACH( PNS_ITEM* item, current->LinkList() )
+        for( PNS_ITEM* item : current->LinkList() )
         {
             if ( item->OfKind( PNS_ITEM::SEGMENT ) )
             {
@@ -870,7 +870,7 @@ void PNS_NODE::MapConnectivity ( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFo
         }
     }
 
-    BOOST_FOREACH(PNS_JOINT* jt, processed)
+    for(PNS_JOINT* jt : processed)
         aFoundJoints.push_back( jt );
 }
 #endif
@@ -878,7 +878,7 @@ void PNS_NODE::MapConnectivity ( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFo
 
 int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector<PNS_LINE>& aLines )
 {
-    BOOST_FOREACH( PNS_ITEM* item, aA.LinkList() )
+    for( PNS_ITEM* item : aA.LinkList() )
     {
         if( item->Kind() == PNS_ITEM::SEGMENT )
         {
@@ -1113,7 +1113,7 @@ void PNS_NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded )
     if( isRoot() )
         return;
 
-    BOOST_FOREACH( PNS_ITEM* item, m_override )
+    for( PNS_ITEM* item : m_override )
         aRemoved.push_back( item );
 
     for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
@@ -1125,7 +1125,7 @@ void PNS_NODE::releaseChildren()
     // copy the kids as the PNS_NODE destructor erases the item from the parent node.
     std::set<PNS_NODE*> kids = m_children;
 
-    BOOST_FOREACH( PNS_NODE* node, kids )
+    for( PNS_NODE* node : kids )
     {
         node->releaseChildren();
         delete node;
@@ -1138,7 +1138,7 @@ void PNS_NODE::releaseGarbage()
     if( !isRoot() )
         return;
 
-    BOOST_FOREACH( PNS_ITEM* item, m_garbageItems )
+    for( PNS_ITEM* item : m_garbageItems )
     {
         if( !item->BelongsTo( this ) )
             delete item;
@@ -1153,7 +1153,7 @@ void PNS_NODE::Commit( PNS_NODE* aNode )
     if( aNode->isRoot() )
         return;
 
-    BOOST_FOREACH( PNS_ITEM* item, aNode->m_override )
+    for( PNS_ITEM* item : aNode->m_override )
     Remove( item );
 
     for( PNS_INDEX::ITEM_SET::iterator i = aNode->m_index->begin();
@@ -1182,7 +1182,7 @@ void PNS_NODE::AllItemsInNet( int aNet, std::set<PNS_ITEM*>& aItems )
 
     if( l_cur )
     {
-        BOOST_FOREACH( PNS_ITEM*item, *l_cur )
+        for( PNS_ITEM*item : *l_cur )
             aItems.insert( item );
     }
 
@@ -1248,7 +1248,7 @@ PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
     if( !jtStart )
         return NULL;
 
-    BOOST_FOREACH( PNS_ITEM* item, jtStart->LinkList() )
+    for( PNS_ITEM* item : jtStart->LinkList() )
     {
         if( item->OfKind( PNS_ITEM::SEGMENT ) )
         {
@@ -1280,7 +1280,7 @@ PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
 {
     PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
 
-    BOOST_FOREACH( PNS_ITEM*item, *l_cur )
+    for( PNS_ITEM*item : *l_cur )
         if( item->Parent() == aParent )
             return item;
 
diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp
index 249d8b2..061ae76 100644
--- a/pcbnew/router/pns_optimizer.cpp
+++ b/pcbnew/router/pns_optimizer.cpp
@@ -18,8 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
-
 #include <geometry/shape_line_chain.h>
 #include <geometry/shape_rect.h>
 #include <geometry/shape_convex.h>
@@ -271,7 +269,7 @@ int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, c
 
     int n_dirs = 0;
 
-    BOOST_FOREACH( const PNS_ITEM* item, jt->Links().CItems() )
+    for( const PNS_ITEM* item : jt->Links().CItems() )
     {
         if( item->OfKind( PNS_ITEM::VIA ) || item->OfKind( PNS_ITEM::SOLID ) )
             return 0xff;
@@ -814,7 +812,7 @@ PNS_ITEM* PNS_OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP
     if( !jt )
         return NULL;
 
-    BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
+    for( PNS_ITEM* item : jt->LinkList() )
     {
         if( item->OfKind( PNS_ITEM::VIA | PNS_ITEM::SOLID ) )
             return item;
@@ -852,7 +850,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
 
     for( int p = 1; p <= p_end; p++ )
     {
-        BOOST_FOREACH( SHAPE_LINE_CHAIN & l, breakouts ) {
+        for( SHAPE_LINE_CHAIN & l : breakouts ) {
 
             for( int diag = 0; diag < 2; diag++ )
             {
@@ -900,7 +898,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
     bool found = false;
     int p_best = -1;
 
-    BOOST_FOREACH( RtVariant& vp, variants )
+    for( RtVariant& vp : variants )
     {
         PNS_LINE tmp( *aLine, vp.second );
         int cost = PNS_COST_ESTIMATOR::CornerCost( vp.second );
diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp
index 42d3d84..4c15fe8 100644
--- a/pcbnew/router/pns_router.cpp
+++ b/pcbnew/router/pns_router.cpp
@@ -21,8 +21,6 @@
 #include <cstdio>
 #include <vector>
 
-#include <boost/foreach.hpp>
-
 #include <view/view.h>
 #include <view/view_item.h>
 #include <view/view_group.h>
@@ -701,7 +699,7 @@ BOARD* PNS_ROUTER::GetBoard()
 
 void PNS_ROUTER::eraseView()
 {
-    BOOST_FOREACH( BOARD_ITEM* item, m_hiddenItems )
+    for( BOARD_ITEM* item : m_hiddenItems )
     {
         item->ViewSetVisible( true );
     }
@@ -735,7 +733,7 @@ void PNS_ROUTER::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance
 
 void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems )
 {
-    BOOST_FOREACH( const PNS_ITEM* item, aItems.CItems() )
+    for( const PNS_ITEM* item : aItems.CItems() )
         DisplayItem( item );
 }
 
@@ -796,7 +794,7 @@ void PNS_ROUTER::moveDragging( const VECTOR2I& aP, PNS_ITEM* aEndItem )
 void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
                                  PNS_NODE::ITEM_VECTOR& aRemoved )
 {
-    BOOST_FOREACH( PNS_ITEM* item, aCurrent.Items() )
+    for( PNS_ITEM* item : aCurrent.Items() )
     {
         PNS_NODE::OBSTACLES obstacles;
 
@@ -813,7 +811,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
             }
         }
 
-        BOOST_FOREACH( PNS_OBSTACLE& obs, obstacles )
+        for( PNS_OBSTACLE& obs : obstacles )
         {
             int clearance = aNode->GetClearance( item, obs.m_item );
             std::unique_ptr<PNS_ITEM> tmp( obs.m_item->Clone() );
@@ -838,12 +836,12 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
 
     aNode->GetUpdatedItems( removed, added );
 
-    BOOST_FOREACH( PNS_ITEM* item, added )
+    for( PNS_ITEM* item : added )
     {
         DisplayItem( item );
     }
 
-    BOOST_FOREACH( PNS_ITEM* item, removed )
+    for( PNS_ITEM* item : removed )
     {
         BOARD_CONNECTED_ITEM* parent = item->Parent();
 
@@ -878,7 +876,7 @@ void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem )
     m_placer->Move( aP, aEndItem );
     PNS_ITEMSET current = m_placer->Traces();
 
-    BOOST_FOREACH( const PNS_ITEM* item, current.CItems() )
+    for( const PNS_ITEM* item : current.CItems() )
     {
         if( !item->OfKind( PNS_ITEM::LINE ) )
             continue;
@@ -914,7 +912,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
         }
     }
 
-    BOOST_FOREACH( PNS_ITEM* item, added )
+    for( PNS_ITEM* item : added )
     {
         BOARD_CONNECTED_ITEM* newBI = NULL;
 
@@ -1004,7 +1002,7 @@ void PNS_ROUTER::StopRouting()
         std::vector<int> nets;
         m_placer->GetModifiedNets( nets );
 
-        BOOST_FOREACH ( int n, nets )
+        for( int n : nets )
         {
             // Update the ratsnest with new changes
             m_board->GetRatsnest()->Recalculate( n );
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index 3e72443..8d5765c 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -23,8 +23,6 @@
 #include <deque>
 #include <cassert>
 
-#include <boost/foreach.hpp>
-
 #include "trace.h"
 #include "range.h"
 
@@ -223,7 +221,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE&
         {
             PNS_JOINT* jtStart = m_currentNode->FindJoint( aCurrent.CPoint( 0 ), &aCurrent );
 
-            BOOST_FOREACH( PNS_ITEM* item, jtStart->LinkList() )
+            for( PNS_ITEM* item : jtStart->LinkList() )
             {
                 if( m_currentNode->CheckColliding( item, &l ) )
                     colliding = true;
@@ -254,7 +252,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI
 
     if( aObstacle.LinkedSegments() )
     {
-        BOOST_FOREACH( PNS_SEGMENT* s, *aObstacle.LinkedSegments() )
+        for( PNS_SEGMENT* s : *aObstacle.LinkedSegments() )
 
         if( s->Marker() & MK_HEAD )
         {
@@ -411,7 +409,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
         if( !jtStart )
             return SH_INCOMPLETE;
 
-        BOOST_FOREACH( PNS_ITEM* item, jtStart->LinkList() )
+        for( PNS_ITEM* item : jtStart->LinkList() )
         {
             if( item->OfKind( PNS_ITEM::VIA ) )
             {
@@ -430,7 +428,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
 
 #ifdef DEBUG
     m_logger.NewGroup( "on-colliding-solid-cluster", m_iter );
-    BOOST_FOREACH( PNS_ITEM* item, cluster )
+    for( PNS_ITEM* item : cluster )
     {
         m_logger.Log( item, 0, "cluster-entry" );
     }
@@ -601,7 +599,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
         m_draggedViaHeadSet.Clear();
     }
 
-    BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
+    for( PNS_ITEM* item : jt->LinkList() )
     {
         if( PNS_SEGMENT* seg = dyn_cast<PNS_SEGMENT*>( item ) )
         {
@@ -643,7 +641,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
     m_logger.Log( pushedVia, 1, "pushed-via" );
 #endif
 
-    BOOST_FOREACH( LINE_PAIR lp, draggedLines )
+    for( LINE_PAIR lp : draggedLines )
     {
         if( lp.first.Marker() & MK_HEAD )
         {
@@ -742,7 +740,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN
     cur.RemoveVia();
     unwindStack( &aCurrent );
 
-    BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
+    for( PNS_ITEM* item : jt->LinkList() )
     {
         if( item->OfKind( PNS_ITEM::SEGMENT ) && item->LayersOverlap( &aCurrent ) )
         {
@@ -843,7 +841,7 @@ void PNS_SHOVE::unwindStack( PNS_ITEM* aItem )
         if( !l->LinkedSegments() )
             return;
 
-        BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() )
+        for( PNS_SEGMENT* seg : *l->LinkedSegments() )
             unwindStack( seg );
     }
 }
@@ -879,7 +877,7 @@ void PNS_SHOVE::popLine( )
         if( !l.LinkedSegments() )
             continue;
 
-        BOOST_FOREACH( PNS_SEGMENT *s, *l.LinkedSegments() )
+        for( PNS_SEGMENT *s : *l.LinkedSegments() )
         {
             if( i->ContainsSegment( s ) )
             {
@@ -1153,7 +1151,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
 
     PNS_ITEMSET headSet;
 
-    BOOST_FOREACH( const PNS_ITEM* item, aHeadSet.CItems() )
+    for( const PNS_ITEM* item : aHeadSet.CItems() )
     {
         const PNS_LINE* headOrig = static_cast<const PNS_LINE*>( item );
 
@@ -1176,7 +1174,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
     m_currentNode->ClearRanks();
     int n = 0;
 
-    BOOST_FOREACH( const PNS_ITEM* item, aHeadSet.CItems() )
+    for( const PNS_ITEM* item : aHeadSet.CItems() )
     {
         const PNS_LINE* headOrig = static_cast<const PNS_LINE*>( item );
         PNS_LINE head( *headOrig );
diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp
index dae3ea3..3ec1f78 100644
--- a/pcbnew/router/pns_sizes_settings.cpp
+++ b/pcbnew/router/pns_sizes_settings.cpp
@@ -59,7 +59,7 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
     PNS_ITEMSET linkedSegs = jt->Links();
     linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT );
 
-    BOOST_FOREACH( PNS_ITEM* item, linkedSegs.Items() )
+    for( PNS_ITEM* item : linkedSegs.Items() )
     {
         int w = static_cast<PNS_SEGMENT*>( item )->Width();
         mval = std::min( w, mval );
diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp
index 5ebbb2d..4ce0630 100644
--- a/pcbnew/router/pns_tool_base.cpp
+++ b/pcbnew/router/pns_tool_base.cpp
@@ -20,7 +20,6 @@
 
 #include <wx/numdlg.h>
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 #include <boost/bind.hpp>
 
@@ -132,7 +131,7 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a
 
     PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere );
 
-    BOOST_FOREACH( PNS_ITEM* item, candidates.Items() )
+    for( PNS_ITEM* item : candidates.Items() )
     {
         if( !IsCopperLayer( item->Layers().Start() ) )
             continue;
@@ -280,7 +279,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
 
     std::vector<int> nets = m_router->GetCurrentNets();
 
-    BOOST_FOREACH( int net, nets )
+    for( int net : nets )
     {
         endItem = pickSingleItem( p, net, layer );
 
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index 0bd9a37..df1e3c6 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -68,7 +68,7 @@ const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart )
         PNS_JOINT* current = searchQueue.front();
         searchQueue.pop_front();
 
-        BOOST_FOREACH( PNS_ITEM* item, current->LinkList() )
+        for( PNS_ITEM* item : current->LinkList() )
         {
             if( item->OfKind( PNS_ITEM::SEGMENT ) )
             {
@@ -136,9 +136,9 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor,
 
     m_world->AllItemsInNet( aStart->Net(), disconnected );
 
-    BOOST_FOREACH( const PNS_JOINT* jt, ConnectedJoints( aStart ) )
+    for( const PNS_JOINT* jt : ConnectedJoints( aStart ) )
     {
-        BOOST_FOREACH( PNS_ITEM* link, jt->LinkList() )
+        for( PNS_ITEM* link : jt->LinkList() )
         {
             if( disconnected.find( link ) != disconnected.end() )
                 disconnected.erase( link );
@@ -148,7 +148,7 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor,
     int best_dist = INT_MAX;
     PNS_ITEM* best = NULL;
 
-    BOOST_FOREACH( PNS_ITEM* item, disconnected )
+    for( PNS_ITEM* item : disconnected )
     {
         if( item->OfKind( aKindMask ) )
         {
@@ -188,7 +188,7 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET&
         PNS_ITEM* via = NULL;
         PNS_SEGMENT* next_seg = NULL;
 
-        BOOST_FOREACH( PNS_ITEM* link, jt->Links().Items() )
+        for( PNS_ITEM* link : jt->Links().Items() )
         {
             if( link->OfKind( PNS_ITEM::VIA ) )
                 via = link;
@@ -346,7 +346,7 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
 
     if( ( refSeg = dyn_cast<PNS_SEGMENT*>( aStart ) ) != NULL )
     {
-        BOOST_FOREACH( PNS_ITEM* item, coupledItems )
+        for( PNS_ITEM* item : coupledItems )
         {
             if( PNS_SEGMENT* s = dyn_cast<PNS_SEGMENT*>( item ) )
             {
@@ -419,7 +419,7 @@ const std::set<PNS_ITEM*> PNS_TOPOLOGY::AssembleCluster( PNS_ITEM* aStart, int a
 
         m_world->QueryColliding( top, obstacles, PNS_ITEM::ANY, -1, false, 0 );
 
-        BOOST_FOREACH( PNS_OBSTACLE& obs, obstacles )
+        for( PNS_OBSTACLE& obs : obstacles )
         {
             if( visited.find( obs.m_item ) == visited.end() && obs.m_item->Layers().Overlaps( aLayer ) && !( obs.m_item->Marker() & MK_HEAD ) )
             {
diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp
index c7e7e19..27e3ad6 100644
--- a/pcbnew/router/pns_walkaround.cpp
+++ b/pcbnew/router/pns_walkaround.cpp
@@ -18,7 +18,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
 #include <geometry/shape_line_chain.h>
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index b837ad5..6f68f86 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -20,7 +20,6 @@
 
 #include <wx/numdlg.h>
 
-#include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 #include <boost/bind.hpp>
 
diff --git a/pcbnew/tools/edit_points.cpp b/pcbnew/tools/edit_points.cpp
index cbd2a77..1ee9d64 100644
--- a/pcbnew/tools/edit_points.cpp
+++ b/pcbnew/tools/edit_points.cpp
@@ -22,8 +22,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-#include <boost/foreach.hpp>
-
 #include <gal/graphics_abstraction_layer.h>
 #include "edit_points.h"
 
@@ -74,7 +72,7 @@ int EDIT_POINTS::GetContourStartIdx( int aPointIdx ) const
 {
     int lastIdx = 0;
 
-    BOOST_FOREACH( int idx, m_contours )
+    for( int idx : m_contours )
     {
         if( idx >= aPointIdx )
             return lastIdx;
@@ -88,7 +86,7 @@ int EDIT_POINTS::GetContourStartIdx( int aPointIdx ) const
 
 int EDIT_POINTS::GetContourEndIdx( int aPointIdx ) const
 {
-    BOOST_FOREACH( int idx, m_contours )
+    for( int idx : m_contours )
     {
         if( idx >= aPointIdx )
             return idx;
@@ -100,7 +98,7 @@ int EDIT_POINTS::GetContourEndIdx( int aPointIdx ) const
 
 bool EDIT_POINTS::IsContourStart( int aPointIdx ) const
 {
-    BOOST_FOREACH( int idx, m_contours )
+    for( int idx : m_contours )
     {
         if( idx + 1 == aPointIdx )
             return true;
@@ -116,7 +114,7 @@ bool EDIT_POINTS::IsContourStart( int aPointIdx ) const
 
 bool EDIT_POINTS::IsContourEnd( int aPointIdx ) const
 {
-    BOOST_FOREACH( int idx, m_contours )
+    for( int idx : m_contours )
     {
         if( idx == aPointIdx )
             return true;
@@ -215,10 +213,10 @@ void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
 
     float size = m_view->ToWorld( EDIT_POINT::POINT_SIZE );
 
-    BOOST_FOREACH( const EDIT_POINT& point, m_points )
+    for( const EDIT_POINT& point : m_points )
         aGal->DrawRectangle( point.GetPosition() - size / 2, point.GetPosition() + size / 2 );
 
-    BOOST_FOREACH( const EDIT_LINE& line, m_lines )
+    for( const EDIT_LINE& line : m_lines )
     {
         aGal->DrawCircle( line.GetPosition(), size / 2 );
     }
diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index 4bf4ba1..e1c1f61 100644
--- a/pcbnew/tools/edit_tool.cpp
+++ b/pcbnew/tools/edit_tool.cpp
@@ -43,7 +43,6 @@
 #include <confirm.h>
 
 #include <cassert>
-#include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 
 #include "common_actions.h"
@@ -974,7 +973,7 @@ void EDIT_TOOL::processUndoBuffer( const PICKED_ITEMS_LIST* aLastChange )
     const std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;
     bool process = false;
 
-    BOOST_FOREACH( const PICKED_ITEMS_LIST* list, undoList )
+    for( const PICKED_ITEMS_LIST* list : undoList )
     {
         if( process )
             processPickedList( list );
@@ -986,7 +985,7 @@ void EDIT_TOOL::processUndoBuffer( const PICKED_ITEMS_LIST* aLastChange )
     // then the undo list must have been completely altered, so process everything
     if( !process )
     {
-        BOOST_FOREACH( const PICKED_ITEMS_LIST* list, undoList )
+        for( const PICKED_ITEMS_LIST* list : undoList )
             processPickedList( list );
     }
 }
diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp
index b53fca2..56da093 100644
--- a/pcbnew/tools/grid_helper.cpp
+++ b/pcbnew/tools/grid_helper.cpp
@@ -22,7 +22,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-#include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 
 #include <wxPcbStruct.h>
@@ -218,7 +217,7 @@ VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, BOARD_ITEM* aDrag
 
     clearAnchors();
 
-    BOOST_FOREACH( BOARD_ITEM* item, queryVisible( bb ) )
+    for( BOARD_ITEM* item : queryVisible( bb ) )
     {
         computeAnchors( item, aOrigin );
     }
@@ -369,7 +368,7 @@ GRID_HELPER::ANCHOR* GRID_HELPER::nearestAnchor( const VECTOR2I& aPos, int aFlag
      double minDist = std::numeric_limits<double>::max();
      ANCHOR* best = NULL;
 
-     BOOST_FOREACH( ANCHOR& a, m_anchors )
+     for( ANCHOR& a : m_anchors )
      {
          if( !aMatchLayers[a.item->GetLayer()] )
              continue;
diff --git a/pcbnew/tools/module_tools.cpp b/pcbnew/tools/module_tools.cpp
index 2c34d83..17d2e93 100644
--- a/pcbnew/tools/module_tools.cpp
+++ b/pcbnew/tools/module_tools.cpp
@@ -45,7 +45,6 @@
 #include <class_edge_mod.h>
 
 #include <boost/bind.hpp>
-#include <boost/foreach.hpp>
 #include <wx/defs.h>
 
 MODULE_TOOLS::MODULE_TOOLS() :
@@ -279,7 +278,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
                 selectedPads.unique();
             }
 
-            BOOST_FOREACH( D_PAD* pad, selectedPads )
+            for( D_PAD* pad : selectedPads )
             {
                 std::set<D_PAD*>::iterator it = allPads.find( pad );
 
@@ -310,7 +309,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
             m_frame->OnModify();
             m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
 
-            BOOST_FOREACH( D_PAD* pad, pads )
+            for( D_PAD* pad : pads )
             {
                 pad->SetPadName( wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), padNumber++ ) );
                 pad->ViewUpdate();
@@ -325,7 +324,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
         }
     }
 
-    BOOST_FOREACH( D_PAD* pad, pads )
+    for( D_PAD* pad : pads )
         pad->ClearSelected();
 
     m_frame->DisplayToolMsg( wxEmptyString );
@@ -548,7 +547,7 @@ int MODULE_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
 
     bool enable = !settings->GetSketchMode( layers[0] );
 
-    BOOST_FOREACH( LAYER_NUM layer, layers )
+    for( LAYER_NUM layer : layers )
         settings->SetSketchMode( layer, enable );
 
     for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
@@ -582,7 +581,7 @@ int MODULE_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
 
     bool enable = !settings->GetSketchMode( layers[0] );
 
-    BOOST_FOREACH( LAYER_NUM layer, layers )
+    for( LAYER_NUM layer : layers )
         settings->SetSketchMode( layer, enable );
 
     for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp
index d962492..8452d18 100644
--- a/pcbnew/tools/placement_tool.cpp
+++ b/pcbnew/tools/placement_tool.cpp
@@ -32,7 +32,6 @@
 #include <ratsnest_data.h>
 
 #include <confirm.h>
-#include <boost/foreach.hpp>
 
 PLACEMENT_TOOL::PLACEMENT_TOOL() :
     TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL ), m_placementMenu( NULL )
@@ -277,7 +276,7 @@ int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
         // Distance between items
         const int distance = ( maxX - position ) / ( itemsList.size() - 1 );
 
-        BOOST_FOREACH( BOARD_ITEM* item, itemsList )
+        for( BOARD_ITEM* item : itemsList )
         {
             int difference = position - item->GetBoundingBox().Centre().x;
 
@@ -324,7 +323,7 @@ int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
         // Distance between items
         const int distance = ( maxY - position ) / ( itemsList.size() - 1 );
 
-        BOOST_FOREACH( BOARD_ITEM* item, itemsList )
+        for( BOARD_ITEM* item : itemsList )
         {
             int difference = position - item->GetBoundingBox().Centre().y;
 
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index c548c2f..a2a8bb2 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -24,7 +24,6 @@
  */
 #include <limits>
 
-#include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
 
@@ -670,7 +669,7 @@ int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent )
 
     ratsnest->GetConnectedItems( item, itemsList, (RN_ITEM_TYPE)( RN_TRACKS | RN_VIAS ) );
 
-    BOOST_FOREACH( BOARD_CONNECTED_ITEM* i, itemsList )
+    for( BOARD_CONNECTED_ITEM* i : itemsList )
         select( i );
 
     // Inform other potentially interested tools
@@ -695,7 +694,7 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
     clearSelection();
     ratsnest->GetNetItems( netCode, itemsList, (RN_ITEM_TYPE)( RN_TRACKS | RN_VIAS ) );
 
-    BOOST_FOREACH( BOARD_CONNECTED_ITEM* i, itemsList )
+    for( BOARD_CONNECTED_ITEM* i : itemsList )
         select( i );
 
     // Inform other potentially interested tools
@@ -1194,7 +1193,7 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) c
         {
             aCollector.Empty();
 
-            BOOST_FOREACH( BOARD_ITEM* item, preferred )
+            for( BOARD_ITEM* item : preferred )
                 aCollector.Append( item );
             return;
         }
@@ -1364,7 +1363,7 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) c
 
     if( (unsigned) aCollector.GetCount() > rejected.size() )  // do not remove everything
     {
-        BOOST_FOREACH( BOARD_ITEM* item, rejected )
+        for( BOARD_ITEM* item : rejected )
         {
             aCollector.Remove( item );
         }
@@ -1405,7 +1404,7 @@ bool SELECTION_TOOL::SanitizeSelection()
 
     if( !rejected.empty() )
     {
-        BOOST_FOREACH( BOARD_ITEM* item, rejected )
+        for( BOARD_ITEM* item : rejected )
             unselect( item );
 
         // Inform other potentially interested tools
@@ -1414,7 +1413,7 @@ bool SELECTION_TOOL::SanitizeSelection()
 
     if( !added.empty() )
     {
-        BOOST_FOREACH( BOARD_ITEM* item, added )
+        for( BOARD_ITEM* item : added )
             select( item );
 
         // Inform other potentially interested tools
diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
index 478751c..0e5d74b 100644
--- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
@@ -69,8 +69,6 @@
 #include <geometry/shape_poly_set.h>
 #include <geometry/shape_file_io.h>
 
-#include <boost/foreach.hpp>
-
 /* DEBUG OPTION:
  * To emit zone data to a file when filling zones for the debugging purposes,
  * set this 'true' and build.