Utility to use 'hash' as the equality operator as well in std containers
| 57 | |
| 58 | // Utility to use 'hash' as the equality operator as well in std containers |
| 59 | struct PatternPointerEquality { |
| 60 | template <typename P1, typename P2> |
| 61 | bool operator()(std::shared_ptr<P1> const& p1, std::shared_ptr<P2> const& p2) const { |
| 62 | return p1->hash()==p2->hash(); |
| 63 | } |
| 64 | template <typename P1, typename P2> |
| 65 | bool operator()(P1 const* p1, P2 const* p2) const { |
| 66 | return p1->hash()==p2->hash(); |
| 67 | } |
| 68 | }; |
| 69 | |
| 70 | // A hash-set that uniques by hash value |
| 71 | using UniquePatternSet = std::unordered_set<std::shared_ptr<Pattern>, PatternHasher, PatternPointerEquality>; |
nothing calls this directly
no outgoing calls
no test coverage detected