From b60f7d4136a51b457ae72dfa3e6b8dd5b855139d Mon Sep 17 00:00:00 2001 From: Kuba Sunderland-Ober Date: Tue, 20 Jun 2023 16:35:03 -0400 Subject: [PATCH] Make comparison operators const. --- common/tool/selection.cpp | 2 +- include/enum_vector.h | 4 ++-- include/tool/selection.h | 2 +- pcbnew/dialogs/dialog_board_statistics.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/tool/selection.cpp b/common/tool/selection.cpp index db233335eb..dec4a25cf6 100644 --- a/common/tool/selection.cpp +++ b/common/tool/selection.cpp @@ -29,7 +29,7 @@ #include -bool SELECTION::operator==( const SELECTION& aOther ) +bool SELECTION::operator==( const SELECTION& aOther ) const { return ( m_items == aOther.m_items && m_itemsOrders == aOther.m_itemsOrders diff --git a/include/enum_vector.h b/include/enum_vector.h index 62da55df00..afb224da1b 100644 --- a/include/enum_vector.h +++ b/include/enum_vector.h @@ -92,8 +92,8 @@ public: T operator*() { return static_cast( val ); } ENUM_ITERATOR begin() { return *this; } ENUM_ITERATOR end() { return ENUM_ITERATOR( endVal ); } - bool operator==( const ENUM_ITERATOR& aIt ) { return val == aIt.val; } - bool operator!=( const ENUM_ITERATOR& aIt ) { return val != aIt.val; } + bool operator==( const ENUM_ITERATOR& aIt ) const { return val == aIt.val; } + bool operator!=( const ENUM_ITERATOR& aIt ) const { return val != aIt.val; } }; #endif /* ENUM_VECTOR_H */ diff --git a/include/tool/selection.h b/include/tool/selection.h index 8989d838cc..e6cd075408 100644 --- a/include/tool/selection.h +++ b/include/tool/selection.h @@ -65,7 +65,7 @@ public: return *this; } - bool operator==( const SELECTION& aOther ); + bool operator==( const SELECTION& aOther ) const; using ITER = std::deque::iterator; using CITER = std::deque::const_iterator; diff --git a/pcbnew/dialogs/dialog_board_statistics.h b/pcbnew/dialogs/dialog_board_statistics.h index b58f54b82a..f19bd7906a 100644 --- a/pcbnew/dialogs/dialog_board_statistics.h +++ b/pcbnew/dialogs/dialog_board_statistics.h @@ -110,7 +110,7 @@ public: { } - bool operator==( const DRILL_LINE_ITEM& other ) + bool operator==( const DRILL_LINE_ITEM& other ) const { return xSize == other.xSize && ySize == other.ySize && shape == other.shape && isPlated == other.isPlated && isPad == other.isPad