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

Class PatternHasher

docopt_private.h:43–56  ·  view source on GitHub ↗

Utility to use Pattern types in std hash-containers

Source from the content-addressed store, hash-verified

41
42 // Utility to use Pattern types in std hash-containers
43 struct PatternHasher {
44 template <typename P>
45 size_t operator()(std::shared_ptr<P> const& pattern) const {
46 return pattern->hash();
47 }
48 template <typename P>
49 size_t operator()(P const* pattern) const {
50 return pattern->hash();
51 }
52 template <typename P>
53 size_t operator()(P const& pattern) const {
54 return pattern.hash();
55 }
56 };
57
58 // Utility to use 'hash' as the equality operator as well in std containers
59 struct PatternPointerEquality {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected