Skip to content

Commit

Permalink
Rewrite function call operator of LMOCompare class in templated version
Browse files Browse the repository at this point in the history
* Due to GCC 8.x.y compiler static assertion fail (fixes DegateCommunity#6)
  • Loading branch information
Dmitry Trefilov committed Jul 28, 2021
1 parent 6422549 commit 98c431e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/Core/LogicModel/LogicModelObjectBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,3 @@ const std::string LogicModelObjectBase::get_object_type_name() const
{
return tr("Generic object").toStdString();
}


bool LMOCompare::operator()(const LogicModelObjectBase& a, const LogicModelObjectBase& b) const
{
return a.get_object_id() < b.get_object_id();
}

bool LMOCompare::operator()(const LogicModelObjectBase_shptr& a, const LogicModelObjectBase_shptr& b) const
{
return this->operator()(*a, *b);
}
12 changes: 10 additions & 2 deletions src/Core/LogicModel/LogicModelObjectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,16 @@ namespace degate
class LMOCompare
{
public:
bool operator()(const LogicModelObjectBase& a, const LogicModelObjectBase& b) const;
bool operator()(const LogicModelObjectBase_shptr& a, const LogicModelObjectBase_shptr& b) const;
template <typename T>
bool operator()(const T& a, const T& b) const
{
return a.get_object_id() < b.get_object_id();
}
template <typename T>
bool operator()(const std::shared_ptr<T>& a, const std::shared_ptr<T>& b) const
{
return this->operator()(*a, *b);
}
};
}

Expand Down

0 comments on commit 98c431e

Please sign in to comment.