From c093fe135550daa72de9c16d77265a137deaeeaf Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <seth@kipro-pcb.com>
Date: Tue, 16 Jul 2024 14:48:33 -0700
Subject: [PATCH] Simplify LSEQ

Remove unneeded operators and index
---
 include/lseq.h                 | 17 +++--------------
 pcbnew/pad.cpp                 |  2 +-
 pcbnew/pcbnew_jobs_handler.cpp |  2 +-
 pcbnew/tools/pad_tool.cpp      |  2 +-
 4 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/include/lseq.h b/include/lseq.h
index 486fd40bd3..934090048f 100644
--- a/include/lseq.h
+++ b/include/lseq.h
@@ -45,31 +45,20 @@ typedef std::vector<PCB_LAYER_ID>   BASE_SEQ;
  */
 class KICOMMON_API LSEQ : public BASE_SEQ
 {
-    unsigned   m_index;
-
 public:
 
-    LSEQ() :
-        m_index( 0 )
+    LSEQ()
     {}
 
     template <class InputIterator>
     LSEQ( InputIterator aStart, InputIterator aEnd ) :
-        BASE_SEQ( aStart, aEnd ), m_index( 0 )
+        BASE_SEQ( aStart, aEnd )
     {}
 
     LSEQ( std::initializer_list<PCB_LAYER_ID> aLayers ) :
-            BASE_SEQ( aLayers ), m_index( 0 )
+        BASE_SEQ( aLayers )
     {}
 
-
-    operator bool ()        { return m_index < size(); }
-
-    PCB_LAYER_ID operator * () const
-    {
-        return at( m_index );       // throws std::out_of_range
-    }
-
     int TestLayers( PCB_LAYER_ID aRhs, PCB_LAYER_ID aLhs ) const;
 };
 
diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp
index 5dd7b7ef2b..43d04df620 100644
--- a/pcbnew/pad.cpp
+++ b/pcbnew/pad.cpp
@@ -1990,7 +1990,7 @@ std::vector<PCB_SHAPE*> PAD::Recombine( bool aIsDryRun, int maxError )
     else if( IsOnLayer( B_Cu ) )
         layer = B_Cu;
     else
-        layer = *GetLayerSet().UIOrder();
+        layer = GetLayerSet().UIOrder().front();
 
     // If there are intersecting items to combine, we need to first make sure the pad is a
     // custom-shape pad.
diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp
index c6fd922b04..0f225dfd4f 100644
--- a/pcbnew/pcbnew_jobs_handler.cpp
+++ b/pcbnew/pcbnew_jobs_handler.cpp
@@ -667,7 +667,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
     else
     {
         // default to the board enabled layers
-        if( aGerberJob->m_printMaskLayer == 0 )
+        if( aGerberJob->m_printMaskLayer.empty() )
             aGerberJob->m_printMaskLayer = brd->GetEnabledLayers().SeqStackupForPlotting();
 
         if( aGerberJob->m_layersIncludeOnAllSet )
diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp
index c89680ee2d..ba91d155b2 100644
--- a/pcbnew/tools/pad_tool.cpp
+++ b/pcbnew/tools/pad_tool.cpp
@@ -812,7 +812,7 @@ void PAD_TOOL::explodePad( PAD* aPad, PCB_LAYER_ID* aLayer, BOARD_COMMIT& aCommi
     else if( aPad->IsOnLayer( B_Cu ) )
         *aLayer = B_Cu;
     else
-        *aLayer = *aPad->GetLayerSet().UIOrder();
+        *aLayer = aPad->GetLayerSet().UIOrder().front();
 
     if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
     {