Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
HashNamespace.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SKYFIRE_HASH_NAMESPACE_H
7#define SKYFIRE_HASH_NAMESPACE_H
8
9#include "Define.h"
10
11#if COMPILER_HAS_CPP11_SUPPORT
12# define HASH_NAMESPACE_START namespace std {
13# define HASH_NAMESPACE_END }
14#elif defined(_STLPORT_VERSION)
15# define HASH_NAMESPACE_START namespace std {
16# define HASH_NAMESPACE_END }
17#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
18# define HASH_NAMESPACE_START namespace std {
19# define HASH_NAMESPACE_END }
20#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
21# define HASH_NAMESPACE_START namespace std { namespace tr1 {
22# define HASH_NAMESPACE_END } }
23#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
24# define HASH_NAMESPACE_START namespace stdext {
25# define HASH_NAMESPACE_END }
26
27#if !_HAS_TRADITIONAL_STL
28#ifndef HASH_NAMESPACE
29#define HASH_NAMESPACE
30#else
31
32// can be not used by some platforms, so provide fake forward
34
35template<class K>
36class hash
37{
38public:
39 size_t operator() (K const&);
40};
41
43
44#endif
45#endif
46
47#elif COMPILER == COMPILER_INTEL
48# define HASH_NAMESPACE_START namespace std {
49# define HASH_NAMESPACE_END }
50#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
51# define HASH_NAMESPACE_START namespace std {
52# define HASH_NAMESPACE_END }
53#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
54# define HASH_NAMESPACE_START namespace std { namespace tr1 {
55# define HASH_NAMESPACE_END } }
56#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
57# define HASH_NAMESPACE_START namespace __gnu_cxx {
58# define HASH_NAMESPACE_END }
59
60#include <ext/hash_fun.h>
61#include <string>
62
64
65template<>
66class hash<unsigned long long>
67{
68public:
69 size_t operator()(const unsigned long long& __x) const { return (size_t)__x; }
70};
71
72template<typename T>
73class hash<T*>
74{
75public:
76 size_t operator()(T* const& __x) const { return (size_t)__x; }
77};
78
79template<> struct hash<std::string>
80{
81 size_t operator()(const std::string& __x) const
82 {
83 return hash<char const*>()(__x.c_str());
84 }
85};
86
88
89#else
90# define HASH_NAMESPACE_START namespace std {
91# define HASH_NAMESPACE_END }
92#endif
93
94#if COMPILER != COMPILER_MICROSOFT
95
96// Visual Studio use non standard hash calculation function, so provide fake forward for other
98
99template<class K>
100size_t hash_value(K const&);
101
103
104#endif
105
106#endif
#define HASH_NAMESPACE_START
#define HASH_NAMESPACE_END