Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: base/hash_tables.h

Issue 67056: Disable gcc 4.4 warnings about hash_map and hash_set being (Closed)
Patch Set: ifdef Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 5
6 // 6 //
7 // Deal with the differences between Microsoft and GNU implemenations 7 // Deal with the differences between Microsoft and GNU implemenations
8 // of hash_map. Allows all platforms to use |base::hash_map| and 8 // of hash_map. Allows all platforms to use |base::hash_map| and
9 // |base::hash_set|. 9 // |base::hash_set|.
10 // eg: 10 // eg:
11 // base::hash_map<int> my_map; 11 // base::hash_map<int> my_map;
12 // base::hash_set<int> my_set; 12 // base::hash_set<int> my_set;
13 // 13 //
14 14
15 #ifndef BASE_HASH_TABLES_H__ 15 #ifndef BASE_HASH_TABLES_H__
16 #define BASE_HASH_TABLES_H__ 16 #define BASE_HASH_TABLES_H__
17 17
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 19
20 #if defined(COMPILER_MSVC) 20 #if defined(COMPILER_MSVC)
21 #include <hash_map> 21 #include <hash_map>
22 #include <hash_set> 22 #include <hash_set>
23 namespace base { 23 namespace base {
24 using stdext::hash_map; 24 using stdext::hash_map;
25 using stdext::hash_set; 25 using stdext::hash_set;
26 } 26 }
27 #elif defined(COMPILER_GCC) 27 #elif defined(COMPILER_GCC)
28 // This is a hack to disable the gcc 4.4 warning about hash_map and hash_set
29 // being deprecated. We can get rid of this when we upgrade to VS2008 and we
30 // can use <tr1/unordered_map> and <tr1/unordered_set>.
31 #ifdef __DEPRECATED
32 #define CHROME_OLD__DEPRECATED __DEPRECATED
33 #undef __DEPRECATED
34 #endif
35
28 #include <ext/hash_map> 36 #include <ext/hash_map>
29 #include <ext/hash_set> 37 #include <ext/hash_set>
38
39 #ifdef CHROME_OLD__DEPRECATED
40 #define __DEPRECATED CHROME_OLD__DEPRECATED
41 #undef CHROME_OLD__DEPRECATED
42 #endif
43
30 #include <tr1/functional> 44 #include <tr1/functional>
31 namespace base { 45 namespace base {
32 using __gnu_cxx::hash_map; 46 using __gnu_cxx::hash_map;
33 using __gnu_cxx::hash_set; 47 using __gnu_cxx::hash_set;
34 } 48 }
35 49
36 // Implement string hash functions so that strings of various flavors can 50 // Implement string hash functions so that strings of various flavors can
37 // be used as keys in STL maps and sets. 51 // be used as keys in STL maps and sets.
38 namespace __gnu_cxx { 52 namespace __gnu_cxx {
39 53
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 size_t operator()(long long i) const { 98 size_t operator()(long long i) const {
85 return std::tr1::hash<long>()((long) i); 99 return std::tr1::hash<long>()((long) i);
86 } 100 }
87 }; 101 };
88 102
89 } 103 }
90 104
91 #endif 105 #endif
92 106
93 #endif // BASE_HASH_TABLES_H__ 107 #endif // BASE_HASH_TABLES_H__
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698