diff options
author | Bo Yang <teboring@google.com> | 2015-04-24 15:34:40 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2015-04-24 18:09:55 -0700 |
commit | d6c9f644ac62ec83196a75a47655a33a87875628 (patch) | |
tree | 742b0ab947ca26d5896c97e5909ca344bcc3ce3a /src/google/protobuf/stubs/hash.h | |
parent | fe7b5667eb446766a1c2f30c691662a36f3df1f8 (diff) |
internal changes
Change-Id: I66f216c70a19f44637090878d7e442d4d0f8991b
Diffstat (limited to 'src/google/protobuf/stubs/hash.h')
-rwxr-xr-x | src/google/protobuf/stubs/hash.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index 82d5052e..11bc2b37 100755 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -172,6 +172,13 @@ struct hash<const char*> { } }; +template<> +struct hash<bool> { + size_t operator()(bool x) const { + return static_cast<size_t>(x); + } +}; + template <typename Key, typename Data, typename HashFcn = hash<Key>, typename EqualKey = std::equal_to<Key>, @@ -204,7 +211,7 @@ struct hash<string> { static const size_t bucket_size = 4; static const size_t min_buckets = 8; - inline size_t operator()(const string& a, const string& b) const { + inline bool operator()(const string& a, const string& b) const { return a < b; } }; @@ -222,7 +229,7 @@ struct hash<pair<First, Second> > { static const size_t bucket_size = 4; static const size_t min_buckets = 8; - inline size_t operator()(const pair<First, Second>& a, + inline bool operator()(const pair<First, Second>& a, const pair<First, Second>& b) const { return a < b; } |