]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/hash_map.h
313b216a78520eba03581fe002290c185519fa01
[user/henk/code/inspircd.git] / include / hash_map.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2009 Robin Burchell <robin+git@viroteck.net>
5  *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
6  *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
7  *   Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
8  *
9  * This file is part of InspIRCd.  InspIRCd is free software: you can
10  * redistribute it and/or modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation, version 2.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22
23 #ifndef INSPIRCD_HASHMAP_H
24 #define INSPIRCD_HASHMAP_H
25
26 #include "inspircd_config.h"
27
28         /** Where hash_map is varies from compiler to compiler
29          * as it is not standard unless we have tr1.
30          */
31         #ifndef WIN32
32                 #ifdef HASHMAP_DEPRECATED
33                         // GCC4+ has deprecated hash_map and uses tr1. But of course, uses a different include to MSVC. FOR FUCKS SAKE.
34                         #include <tr1/unordered_map>
35                         #define HAS_TR1_UNORDERED
36                 #else
37                         #include <ext/hash_map>
38                         /** Oddball linux namespace for hash_map */
39                         #define nspace __gnu_cxx
40                         #define BEGIN_HASHMAP_NAMESPACE namespace nspace {
41                         #define END_HASHMAP_NAMESPACE }
42                 #endif
43         #else
44                 #if _MSC_VER >= 1600
45                         // New MSVC has tr1. Just to make things fucked up, though, MSVC and GCC use different includes! FFS.
46                         #include <unordered_map>
47                         #define HAS_TR1_UNORDERED
48                         #define HASHMAP_DEPRECATED
49                 #else
50                         /** Oddball windows namespace for hash_map */
51                         #include <hash_map>
52                         #define nspace stdext
53                         using stdext::hash_map;
54                         #define BEGIN_HASHMAP_NAMESPACE namespace nspace {
55                         #define END_HASHMAP_NAMESPACE }
56                 #endif
57         #endif
58
59         // tr1: restoring sanity to our headers. now if only compiler vendors could agree on a FUCKING INCLUDE FILE.
60         #ifdef HAS_TR1_UNORDERED
61                 #define hash_map unordered_map
62                 #define nspace std::tr1
63                 #define BEGIN_HASHMAP_NAMESPACE namespace std { namespace tr1 {
64                 #define END_HASHMAP_NAMESPACE } }
65         #endif
66
67 #endif