From 5b5922096a76e859118454b94c5ee9ecf6f6af14 Mon Sep 17 00:00:00 2001 From: Myrtle Shah Date: Sat, 30 Oct 2021 13:36:13 +0100 Subject: [PATCH] Fix 'static assertion failed: comparison object must be invocable as const' Signed-off-by: Myrtle Shah --- anabatic/src/AnabaticEngine.cpp | 4 ++-- anabatic/src/AntennaProtect.cpp | 4 ++-- anabatic/src/Dijkstra.cpp | 2 +- anabatic/src/GCell.cpp | 6 +++--- anabatic/src/anabatic/Dijkstra.h | 2 +- anabatic/src/anabatic/GCell.h | 10 +++++----- hurricane/src/hurricane/hurricane/JsonObject.h | 2 +- hurricane/src/viewer/hurricane/viewer/NetlistWidget.h | 4 ++-- katabatic/src/GCell.cpp | 8 ++++---- katabatic/src/katabatic/GCell.h | 8 ++++---- katana/src/PreProcess.cpp | 4 ++-- katana/src/katana/TrackSegment.h | 4 ++-- kite/src/kite/TrackSegment.h | 4 ++-- solstice/src/solstice/RoutingErrorListWidget.h | 4 ++-- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/anabatic/src/AnabaticEngine.cpp b/anabatic/src/AnabaticEngine.cpp index 2eef301b..696248e2 100644 --- a/anabatic/src/AnabaticEngine.cpp +++ b/anabatic/src/AnabaticEngine.cpp @@ -48,11 +48,11 @@ namespace { class SortAcByXY { public: - inline bool operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ); + inline bool operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ) const; }; - inline bool SortAcByXY::operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ) + inline bool SortAcByXY::operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ) const { DbU::Unit x1 = contact1->getX(); DbU::Unit x2 = contact2->getX(); diff --git a/anabatic/src/AntennaProtect.cpp b/anabatic/src/AntennaProtect.cpp index 9e16089c..2f17d5ac 100644 --- a/anabatic/src/AntennaProtect.cpp +++ b/anabatic/src/AntennaProtect.cpp @@ -50,7 +50,7 @@ namespace { class CompareByLength { public: - inline bool operator() ( const Segment* lhs, const Segment* rhs ) + inline bool operator() ( const Segment* lhs, const Segment* rhs ) const { DbU::Unit delta = lhs->getLength() - rhs->getLength(); if (delta < 0) return false; @@ -61,7 +61,7 @@ namespace { class CompareBySegmentBox { public: - inline bool operator() ( const Box& lhs, const Box& rhs ) + inline bool operator() ( const Box& lhs, const Box& rhs ) const { bool lhsH = (lhs.getWidth() >= lhs.getHeight()); bool rhsH = (rhs.getWidth() >= rhs.getHeight()); diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index d7972848..5223250a 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -1359,7 +1359,7 @@ namespace Anabatic { PriorityQueue* PriorityQueue::CompareByDistance::_pqueue = NULL; - bool PriorityQueue::CompareByDistance::operator() ( const Vertex* lhs, const Vertex* rhs ) + bool PriorityQueue::CompareByDistance::operator() ( const Vertex* lhs, const Vertex* rhs ) const { if (lhs->getDistance() == rhs->getDistance()) { if (_pqueue and _pqueue->hasAttractor()) { diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index 1ae7ea86..04307f85 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -55,7 +55,7 @@ namespace { private: class AxisCompare { public: - bool operator() ( const Axis* lhs, const Axis* rhs ); + bool operator() ( const Axis* lhs, const Axis* rhs ) const; }; class AxisMatch : public unary_function { @@ -155,7 +155,7 @@ namespace { } - inline bool UsedFragments::AxisCompare::operator() ( const Axis* lhs, const Axis* rhs ) + inline bool UsedFragments::AxisCompare::operator() ( const Axis* lhs, const Axis* rhs ) const { if (lhs->getAxis () < rhs->getAxis ()) return true; return false; @@ -259,7 +259,7 @@ namespace Anabatic { { } - bool GCell::CompareByDensity::operator() ( GCell* lhs, GCell* rhs ) + bool GCell::CompareByDensity::operator() ( GCell* lhs, GCell* rhs ) const { float difference = lhs->getDensity(_depth) - rhs->getDensity(_depth); if (difference != 0.0) return (difference > 0.0); diff --git a/anabatic/src/anabatic/Dijkstra.h b/anabatic/src/anabatic/Dijkstra.h index d18f0037..1e0d92ab 100644 --- a/anabatic/src/anabatic/Dijkstra.h +++ b/anabatic/src/anabatic/Dijkstra.h @@ -439,7 +439,7 @@ namespace Anabatic { class CompareByDistance { public: inline CompareByDistance (); - bool operator() ( const Vertex* lhs, const Vertex* rhs ); + bool operator() ( const Vertex* lhs, const Vertex* rhs ) const; static inline void setQueue ( PriorityQueue* ); private: static PriorityQueue* _pqueue; diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index c2f505be..38ca8deb 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -103,13 +103,13 @@ namespace Anabatic { class CompareByDensity : public binary_function { public: CompareByDensity ( size_t depth ); - inline bool operator() ( GCell* lhs, GCell* rhs ); + inline bool operator() ( GCell* lhs, GCell* rhs ) const; private: size_t _depth; }; class CompareByKey : public binary_function { public: - inline bool operator() ( const GCell* lhs, const GCell* rhs ); + inline bool operator() ( const GCell* lhs, const GCell* rhs ) const; }; public: class Key { @@ -125,7 +125,7 @@ namespace Anabatic { public: class Compare { public: - inline bool operator() ( const Key*, const Key* ); + inline bool operator() ( const Key*, const Key* ) const; }; private: const GCell* _gcell; @@ -504,7 +504,7 @@ namespace Anabatic { } // GCell::CompareByKey Inline Functions. - inline bool GCell::CompareByKey::operator() ( const GCell* lhs, const GCell* rhs ) + inline bool GCell::CompareByKey::operator() ( const GCell* lhs, const GCell* rhs ) const { return lhs->getKey() < rhs->getKey(); } @@ -531,7 +531,7 @@ namespace Anabatic { return lhs._gcell->getId() < rhs._gcell->getId(); } - inline bool GCell::Key::Compare::operator() ( const GCell::Key* lhs, const GCell::Key* rhs ) + inline bool GCell::Key::Compare::operator() ( const GCell::Key* lhs, const GCell::Key* rhs ) const { //if (lhs->isSaturated() xor rhs->isSaturated()) return lhs->isSaturated(); diff --git a/hurricane/src/hurricane/hurricane/JsonObject.h b/hurricane/src/hurricane/hurricane/JsonObject.h index 0c2655f5..71afc0cf 100644 --- a/hurricane/src/hurricane/hurricane/JsonObject.h +++ b/hurricane/src/hurricane/hurricane/JsonObject.h @@ -214,7 +214,7 @@ namespace std { template<> struct less { - inline bool operator() ( const Hurricane::JsonObject* lhs, const Hurricane::JsonObject* rhs ) + inline bool operator() ( const Hurricane::JsonObject* lhs, const Hurricane::JsonObject* rhs ) const { return lhs->getTypeName() < rhs->getTypeName(); } }; diff --git a/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h b/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h index 3aa6f01a..68dedac9 100644 --- a/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h @@ -76,11 +76,11 @@ namespace Hurricane { struct SelectedNetCompare { - inline bool operator() ( const SelectedNet& lhs, const SelectedNet& rhs ); + inline bool operator() ( const SelectedNet& lhs, const SelectedNet& rhs ) const; }; - inline bool SelectedNetCompare::operator() ( const SelectedNet& lhs, const SelectedNet& rhs ) + inline bool SelectedNetCompare::operator() ( const SelectedNet& lhs, const SelectedNet& rhs ) const { return lhs.getNet()->getName() < rhs.getNet()->getName(); } diff --git a/katabatic/src/GCell.cpp b/katabatic/src/GCell.cpp index d3aafb92..4749e751 100644 --- a/katabatic/src/GCell.cpp +++ b/katabatic/src/GCell.cpp @@ -66,7 +66,7 @@ namespace { private: class AxisCompare { public: - bool operator() ( const Axis* lhs, const Axis* rhs ); + bool operator() ( const Axis* lhs, const Axis* rhs ) const; }; class AxisMatch : public unary_function { @@ -166,7 +166,7 @@ namespace { } - inline bool UsedFragments::AxisCompare::operator() ( const Axis* lhs, const Axis* rhs ) + inline bool UsedFragments::AxisCompare::operator() ( const Axis* lhs, const Axis* rhs ) const { if ( lhs->getAxis () < rhs->getAxis () ) return true; return false; @@ -273,7 +273,7 @@ namespace Katabatic { { } - bool GCell::CompareByDensity::operator() ( GCell* lhs, GCell* rhs ) + bool GCell::CompareByDensity::operator() ( GCell* lhs, GCell* rhs ) const { //float difference = roundfp ( lhs->getDensity(_depth) - rhs->getDensity(_depth) ); float difference = lhs->getDensity(_depth) - rhs->getDensity(_depth); @@ -292,7 +292,7 @@ namespace Katabatic { // lhs < rhs --> true - bool GCell::CompareByKey::operator() ( const GCell* lhs, const GCell* rhs ) + bool GCell::CompareByKey::operator() ( const GCell* lhs, const GCell* rhs ) const { return lhs->getKey() < rhs->getKey(); } diff --git a/katabatic/src/katabatic/GCell.h b/katabatic/src/katabatic/GCell.h index b24a2d6a..bfd73462 100644 --- a/katabatic/src/katabatic/GCell.h +++ b/katabatic/src/katabatic/GCell.h @@ -76,18 +76,18 @@ namespace Katabatic { public: class CompareByIndex : public binary_function { public: - bool operator() ( const GCell* lhs, const GCell* rhs ); + bool operator() ( const GCell* lhs, const GCell* rhs ) const; }; class CompareByDensity : public binary_function { public: CompareByDensity ( unsigned int depth ); - bool operator() ( GCell* lhs, GCell* rhs ); + bool operator() ( GCell* lhs, GCell* rhs ) const; private: unsigned int _depth; }; class CompareByKey : public binary_function { public: - bool operator() ( const GCell* lhs, const GCell* rhs ); + bool operator() ( const GCell* lhs, const GCell* rhs ) const; }; class Key { @@ -289,7 +289,7 @@ namespace Katabatic { // GCell::CompareByIndex Inline Functions. - inline bool GCell::CompareByIndex::operator() ( const GCell* lhs, const GCell* rhs ) + inline bool GCell::CompareByIndex::operator() ( const GCell* lhs, const GCell* rhs ) const { return ( lhs->getIndex() < rhs->getIndex() ); } diff --git a/katana/src/PreProcess.cpp b/katana/src/PreProcess.cpp index d91950db..fda16fef 100644 --- a/katana/src/PreProcess.cpp +++ b/katana/src/PreProcess.cpp @@ -47,11 +47,11 @@ namespace { class SortAcByXY { public: - inline bool operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ); + inline bool operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ) const; }; - inline bool SortAcByXY::operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ) + inline bool SortAcByXY::operator() ( AutoContactTerminal* contact1, AutoContactTerminal* contact2 ) const { DbU::Unit x1 = contact1->getX(); DbU::Unit x2 = contact2->getX(); diff --git a/katana/src/katana/TrackSegment.h b/katana/src/katana/TrackSegment.h index 2059dfa8..d1957100 100644 --- a/katana/src/katana/TrackSegment.h +++ b/katana/src/katana/TrackSegment.h @@ -52,7 +52,7 @@ namespace Katana { public: class CompareById : public binary_function { public: - inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ); + inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) const; }; public: @@ -181,7 +181,7 @@ namespace Katana { }; - inline bool TrackSegment::CompareById::operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) + inline bool TrackSegment::CompareById::operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) const { return lhs->getId() < rhs->getId(); } diff --git a/kite/src/kite/TrackSegment.h b/kite/src/kite/TrackSegment.h index 4062381a..9dfd0d85 100644 --- a/kite/src/kite/TrackSegment.h +++ b/kite/src/kite/TrackSegment.h @@ -47,7 +47,7 @@ namespace Kite { public: class CompareById : public binary_function { public: - inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ); + inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) const; }; public: @@ -150,7 +150,7 @@ namespace Kite { }; - inline bool TrackSegment::CompareById::operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) + inline bool TrackSegment::CompareById::operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) const { return lhs->getId() < rhs->getId(); } diff --git a/solstice/src/solstice/RoutingErrorListWidget.h b/solstice/src/solstice/RoutingErrorListWidget.h index 55c0a054..491af366 100644 --- a/solstice/src/solstice/RoutingErrorListWidget.h +++ b/solstice/src/solstice/RoutingErrorListWidget.h @@ -90,11 +90,11 @@ namespace Solstice { struct SelectedRoutingErrorCompare { - inline bool operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ); + inline bool operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ) const; }; - inline bool SelectedRoutingErrorCompare::operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ) + inline bool SelectedRoutingErrorCompare::operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ) const { return lhs.getRoutingError() < rhs.getRoutingError(); }