Replace boost::unordered_map, boost::unordered_set with std::unordered_map, std::unordered_set to establish consistency.

Replace boost::hash_combine with a lib/hash.h hash_combine performing
the same statement.
Replace inconspicuous global boost hash_value specializations with
std::hash specializations.
No performance difference was observed in three simple MeshManager
measurements.

Remove unused TAG_MASK and h_tag in h_mgr.cpp following 0748c5a75e.
Replace typedef with using keyword and sort header includes.

Differential Revision: https://code.wildfiregames.com/D2441
Tested on: clang  9.0.0, gcc 9.2.0, Jenkins/vs2015, Jenkins/gcc6

This was SVN commit r23191.
This commit is contained in:
elexis
2019-11-25 14:30:25 +00:00
parent acbfd21992
commit 5d2c20beb0
33 changed files with 295 additions and 270 deletions
+5 -13
View File
@@ -23,7 +23,7 @@
#include "ps/CLogger.h"
#include "ps/ThreadUtil.h"
#include <boost/unordered_map.hpp>
#include <unordered_map>
class CStrInternInternals
{
@@ -49,7 +49,7 @@ private:
// Interned strings are stored in a hash table, indexed by string:
typedef std::string StringsKey;
using StringsKey = std::string;
struct StringsKeyHash
{
@@ -60,7 +60,7 @@ struct StringsKeyHash
};
// To avoid std::string memory allocations when GetString does lookups in the
// hash table of interned strings, we make use of boost::unordered_map's ability
// hash table of interned strings, we make use of std::unordered_map's ability
// to do lookups with a functionally equivalent proxy object:
struct StringsKeyProxy
@@ -85,7 +85,7 @@ struct StringsKeyProxyEq
}
};
static boost::unordered_map<StringsKey, shared_ptr<CStrInternInternals>, StringsKeyHash> g_Strings;
static std::unordered_map<StringsKey, shared_ptr<CStrInternInternals>, StringsKeyHash> g_Strings;
#define X(id) CStrIntern str_##id(#id);
#define X2(id, str) CStrIntern str_##id(str);
@@ -100,15 +100,7 @@ static CStrInternInternals* GetString(const char* str, size_t len)
// to be thread-safe, preferably without sacrificing performance.)
ENSURE(ThreadUtil::IsMainThread());
#if BOOST_VERSION >= 104200
StringsKeyProxy proxy = { str, len };
boost::unordered_map<StringsKey, shared_ptr<CStrInternInternals> >::iterator it =
g_Strings.find(proxy, StringsKeyProxyHash(), StringsKeyProxyEq());
#else
// Boost <= 1.41 doesn't support the new find(), so do a slightly less efficient lookup
boost::unordered_map<StringsKey, shared_ptr<CStrInternInternals> >::iterator it =
g_Strings.find(str);
#endif
std::unordered_map<StringsKey, shared_ptr<CStrInternInternals> >::iterator it = g_Strings.find(str);
if (it != g_Strings.end())
return it->second.get();