Use (if available) TR1 unordered_map instead hash_map at Unix/Linux (in GCC 4.0.0 and later) and Windows (VC90 and later)

This commit is contained in:
VladimirMangos 2008-11-08 10:21:42 +03:00
parent ac222e92b1
commit 5222f49820
25 changed files with 80 additions and 73 deletions

View file

@ -20,7 +20,7 @@
#define MANGOS_OBJECTREGISTRY_H
#include "Platform/Define.h"
#include "Utilities/HashMap.h"
#include "Utilities/UnorderedMap.h"
#include "Policies/Singleton.h"
#include <string>

View file

@ -58,6 +58,6 @@ EXTRA_DIST = \
Utilities/ByteConverter.h \
Utilities/Callback.h \
Utilities/EventProcessor.h \
Utilities/HashMap.h \
Utilities/UnorderedMap.h \
Utilities/LinkedList.h \
Utilities/TypeList.h

View file

@ -16,32 +16,39 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_HASHMAP_H
#define MANGOS_HASHMAP_H
#ifndef MANGOS_UNORDERED_MAP_H
#define MANGOS_UNORDERED_MAP_H
#include "Platform/CompilerDefs.h"
#include "Platform/Define.h"
#if COMPILER == COMPILER_INTEL
#include <ext/hash_map>
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4
#include <tr1/unordered_map>
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
#include <ext/hash_map>
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 // VC9.0 and later
#include <unordered_map>
#else
#include <hash_map>
#endif
#ifdef _STLPORT_VERSION
#define HM_NAMESPACE std
#define UNORDERED_MAP std::hash_map
using std::hash_map;
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500
#define UNORDERED_MAP std::tr1::unordered_map
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
#define HM_NAMESPACE stdext
#define UNORDERED_MAP stdext::hash_map
using stdext::hash_map;
#elif COMPILER == COMPILER_INTEL
#define HM_NAMESPACE std
#define UNORDERED_MAP std::hash_map
using std::hash_map;
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4
#define UNORDERED_MAP std::tr1::unordered_map
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
#define HM_NAMESPACE __gnu_cxx
using __gnu_cxx::hash_map;
#define UNORDERED_MAP std::__gnu_cxx::hash_map
namespace __gnu_cxx
{
@ -57,7 +64,7 @@ namespace __gnu_cxx
};
#else
#define HM_NAMESPACE std
#define UNORDERED_MAP std::hash_map
using std::hash_map;
#endif
#endif