Fix 'static assertion failed: comparison object must be invocable as const'

Signed-off-by: Myrtle Shah <gatecat@chipflow.io>
This commit is contained in:
Myrtle Shah 2021-10-30 13:36:13 +01:00
parent 1bb5a0ae15
commit 5b5922096a
14 changed files with 33 additions and 33 deletions

View File

@ -48,11 +48,11 @@ namespace {
class SortAcByXY { class SortAcByXY {
public: 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 x1 = contact1->getX();
DbU::Unit x2 = contact2->getX(); DbU::Unit x2 = contact2->getX();

View File

@ -50,7 +50,7 @@ namespace {
class CompareByLength { class CompareByLength {
public: 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(); DbU::Unit delta = lhs->getLength() - rhs->getLength();
if (delta < 0) return false; if (delta < 0) return false;
@ -61,7 +61,7 @@ namespace {
class CompareBySegmentBox { class CompareBySegmentBox {
public: 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 lhsH = (lhs.getWidth() >= lhs.getHeight());
bool rhsH = (rhs.getWidth() >= rhs.getHeight()); bool rhsH = (rhs.getWidth() >= rhs.getHeight());

View File

@ -1359,7 +1359,7 @@ namespace Anabatic {
PriorityQueue* PriorityQueue::CompareByDistance::_pqueue = NULL; 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 (lhs->getDistance() == rhs->getDistance()) {
if (_pqueue and _pqueue->hasAttractor()) { if (_pqueue and _pqueue->hasAttractor()) {

View File

@ -55,7 +55,7 @@ namespace {
private: private:
class AxisCompare { class AxisCompare {
public: public:
bool operator() ( const Axis* lhs, const Axis* rhs ); bool operator() ( const Axis* lhs, const Axis* rhs ) const;
}; };
class AxisMatch : public unary_function<Axis*,bool> { class AxisMatch : public unary_function<Axis*,bool> {
@ -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; if (lhs->getAxis () < rhs->getAxis ()) return true;
return false; 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); float difference = lhs->getDensity(_depth) - rhs->getDensity(_depth);
if (difference != 0.0) return (difference > 0.0); if (difference != 0.0) return (difference > 0.0);

View File

@ -439,7 +439,7 @@ namespace Anabatic {
class CompareByDistance { class CompareByDistance {
public: public:
inline CompareByDistance (); inline CompareByDistance ();
bool operator() ( const Vertex* lhs, const Vertex* rhs ); bool operator() ( const Vertex* lhs, const Vertex* rhs ) const;
static inline void setQueue ( PriorityQueue* ); static inline void setQueue ( PriorityQueue* );
private: private:
static PriorityQueue* _pqueue; static PriorityQueue* _pqueue;

View File

@ -103,13 +103,13 @@ namespace Anabatic {
class CompareByDensity : public binary_function<GCell*,GCell*,bool> { class CompareByDensity : public binary_function<GCell*,GCell*,bool> {
public: public:
CompareByDensity ( size_t depth ); CompareByDensity ( size_t depth );
inline bool operator() ( GCell* lhs, GCell* rhs ); inline bool operator() ( GCell* lhs, GCell* rhs ) const;
private: private:
size_t _depth; size_t _depth;
}; };
class CompareByKey : public binary_function<const GCell*,const GCell*,bool> { class CompareByKey : public binary_function<const GCell*,const GCell*,bool> {
public: public:
inline bool operator() ( const GCell* lhs, const GCell* rhs ); inline bool operator() ( const GCell* lhs, const GCell* rhs ) const;
}; };
public: public:
class Key { class Key {
@ -125,7 +125,7 @@ namespace Anabatic {
public: public:
class Compare { class Compare {
public: public:
inline bool operator() ( const Key*, const Key* ); inline bool operator() ( const Key*, const Key* ) const;
}; };
private: private:
const GCell* _gcell; const GCell* _gcell;
@ -504,7 +504,7 @@ namespace Anabatic {
} }
// GCell::CompareByKey Inline Functions. // 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(); } { return lhs->getKey() < rhs->getKey(); }
@ -531,7 +531,7 @@ namespace Anabatic {
return lhs._gcell->getId() < rhs._gcell->getId(); 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(); //if (lhs->isSaturated() xor rhs->isSaturated()) return lhs->isSaturated();

View File

@ -214,7 +214,7 @@ namespace std {
template<> template<>
struct less<Hurricane::JsonObject*> { struct less<Hurricane::JsonObject*> {
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(); } { return lhs->getTypeName() < rhs->getTypeName(); }
}; };

View File

@ -76,11 +76,11 @@ namespace Hurricane {
struct SelectedNetCompare { 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(); return lhs.getNet()->getName() < rhs.getNet()->getName();
} }

View File

@ -66,7 +66,7 @@ namespace {
private: private:
class AxisCompare { class AxisCompare {
public: public:
bool operator() ( const Axis* lhs, const Axis* rhs ); bool operator() ( const Axis* lhs, const Axis* rhs ) const;
}; };
class AxisMatch : public unary_function<Axis*,bool> { class AxisMatch : public unary_function<Axis*,bool> {
@ -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; if ( lhs->getAxis () < rhs->getAxis () ) return true;
return false; 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 = roundfp ( lhs->getDensity(_depth) - rhs->getDensity(_depth) );
float difference = lhs->getDensity(_depth) - rhs->getDensity(_depth); float difference = lhs->getDensity(_depth) - rhs->getDensity(_depth);
@ -292,7 +292,7 @@ namespace Katabatic {
// lhs < rhs --> true // 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(); return lhs->getKey() < rhs->getKey();
} }

View File

@ -76,18 +76,18 @@ namespace Katabatic {
public: public:
class CompareByIndex : public binary_function<const GCell*,const GCell*,bool> { class CompareByIndex : public binary_function<const GCell*,const GCell*,bool> {
public: public:
bool operator() ( const GCell* lhs, const GCell* rhs ); bool operator() ( const GCell* lhs, const GCell* rhs ) const;
}; };
class CompareByDensity : public binary_function<GCell*,GCell*,bool> { class CompareByDensity : public binary_function<GCell*,GCell*,bool> {
public: public:
CompareByDensity ( unsigned int depth ); CompareByDensity ( unsigned int depth );
bool operator() ( GCell* lhs, GCell* rhs ); bool operator() ( GCell* lhs, GCell* rhs ) const;
private: private:
unsigned int _depth; unsigned int _depth;
}; };
class CompareByKey : public binary_function<const GCell*,const GCell*,bool> { class CompareByKey : public binary_function<const GCell*,const GCell*,bool> {
public: public:
bool operator() ( const GCell* lhs, const GCell* rhs ); bool operator() ( const GCell* lhs, const GCell* rhs ) const;
}; };
class Key { class Key {
@ -289,7 +289,7 @@ namespace Katabatic {
// GCell::CompareByIndex Inline Functions. // 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() ); } { return ( lhs->getIndex() < rhs->getIndex() ); }

View File

@ -47,11 +47,11 @@ namespace {
class SortAcByXY { class SortAcByXY {
public: 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 x1 = contact1->getX();
DbU::Unit x2 = contact2->getX(); DbU::Unit x2 = contact2->getX();

View File

@ -52,7 +52,7 @@ namespace Katana {
public: public:
class CompareById : public binary_function<const TrackSegment*,const TrackSegment*,bool> { class CompareById : public binary_function<const TrackSegment*,const TrackSegment*,bool> {
public: public:
inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ); inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) const;
}; };
public: 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(); } { return lhs->getId() < rhs->getId(); }

View File

@ -47,7 +47,7 @@ namespace Kite {
public: public:
class CompareById : public binary_function<const TrackSegment*,const TrackSegment*,bool> { class CompareById : public binary_function<const TrackSegment*,const TrackSegment*,bool> {
public: public:
inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ); inline bool operator() ( const TrackSegment* lhs, const TrackSegment* rhs ) const;
}; };
public: 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(); } { return lhs->getId() < rhs->getId(); }

View File

@ -90,11 +90,11 @@ namespace Solstice {
struct SelectedRoutingErrorCompare { 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(); return lhs.getRoutingError() < rhs.getRoutingError();
} }