(std|boost)::hash on a const char* hashes the pointer not the contents
This commit is contained in:
parent
947c2ac8e0
commit
b4ff953aa8
1 changed files with 8 additions and 1 deletions
|
@ -32,6 +32,13 @@
|
|||
#include <osl/mutex.hxx>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
struct THash
|
||||
{
|
||||
size_t operator()( const char* s ) const
|
||||
{
|
||||
return rtl_str_hashCode(s);
|
||||
}
|
||||
};
|
||||
struct TCheck
|
||||
{
|
||||
bool operator()( const char* s1, const char* s2 ) const
|
||||
|
@ -39,7 +46,7 @@ struct TCheck
|
|||
return strcmp( s1, s2 ) == 0;
|
||||
}
|
||||
};
|
||||
typedef boost::unordered_map< const char*, MSO_SPT, boost::hash<const char*>, TCheck> TypeNameHashMap;
|
||||
typedef boost::unordered_map< const char*, MSO_SPT, THash, TCheck> TypeNameHashMap;
|
||||
static TypeNameHashMap* pHashMap = NULL;
|
||||
static ::osl::Mutex& getHashMapMutex()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue