MCPcopy Create free account
hub / github.com/docopt/docopt.cpp / PatternPointerEquality

Class PatternPointerEquality

docopt_private.h:59–68  ·  view source on GitHub ↗

Utility to use 'hash' as the equality operator as well in std containers

Source from the content-addressed store, hash-verified

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>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected