From 4065a31644cf44fd84cc30491a61c4e59d0f2e2a Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Sun, 1 Mar 2015 21:02:22 -0800 Subject: Fix hash.h for MSVC and platforms without hash map/set support. Change-Id: Ic0fdb52c17b9495c73b8ce15879531383a148585 --- src/google/protobuf/stubs/hash.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) mode change 100644 => 100755 src/google/protobuf/stubs/hash.h (limited to 'src/google/protobuf/stubs/hash.h') diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h old mode 100644 new mode 100755 index 96f74a67..82d5052e --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -89,16 +89,17 @@ struct hash { template , - typename EqualKey = int, + typename EqualKey = std::equal_to, typename Alloc = std::allocator< std::pair > > -class hash_map : public std::map { +class hash_map : public std::map { public: - hash_map(int = 0) {} + hash_map(int = 0, const HashFcn& = HashFcn(), const EqualKey& = EqualKey(), + const Alloc& = Alloc()) {} }; template , - typename EqualKey = int > + typename EqualKey = std::equal_to > class hash_set : public std::set { public: hash_set(int = 0) {} @@ -126,19 +127,21 @@ struct hash template , - typename EqualKey = int, + typename EqualKey = std::equal_to, typename Alloc = std::allocator< std::pair > > -class hash_map : public GOOGLE_PROTOBUF_HASH_NAMESPACE::hash_map< - Key, Data, HashFcn, Alloc> { +class hash_map + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, HashFcn, EqualKey, Alloc> { public: - hash_map(int = 0) {} + hash_map(int = 0, const HashFcn& = HashFcn(), const EqualKey& = EqualKey(), + const Alloc& = Alloc()) {} }; -template , - typename EqualKey = int > -class hash_set : public GOOGLE_PROTOBUF_HASH_NAMESPACE::hash_set< - Key, HashFcn> { +template , + typename EqualKey = std::equal_to > +class hash_set + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS< + Key, HashFcn, EqualKey> { public: hash_set(int = 0) {} }; @@ -169,7 +172,8 @@ struct hash { } }; -template , +template , typename EqualKey = std::equal_to, typename Alloc = std::allocator< std::pair > > class hash_map -- cgit v1.2.3