OLD | NEW |
---|---|
1 //===- subzero/src/IceStringPool.h - String pooling -------------*- C++ -*-===// | 1 //===- subzero/src/IceStringPool.h - String pooling -------------*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
11 /// \brief Defines unique pooled strings with short unique IDs. This makes | 11 /// \brief Defines unique pooled strings with short unique IDs. This makes |
12 /// hashing, equality testing, and ordered comparison faster, and avoids a lot | 12 /// hashing, equality testing, and ordered comparison faster, and avoids a lot |
13 /// of memory allocation compared to directly using std::string. | 13 /// of memory allocation compared to directly using std::string. |
14 /// | 14 /// |
15 //===----------------------------------------------------------------------===// | 15 //===----------------------------------------------------------------------===// |
16 | 16 |
17 #ifndef SUBZERO_SRC_ICESTRINGPOOL_H | 17 #ifndef SUBZERO_SRC_ICESTRINGPOOL_H |
18 #define SUBZERO_SRC_ICESTRINGPOOL_H | 18 #define SUBZERO_SRC_ICESTRINGPOOL_H |
19 | 19 |
20 #include "IceDefs.h" // Ostream | |
Eric Holk
2016/04/18 18:51:49
Where does Ostream get used?
Jim Stichnoth
2016/04/18 19:49:48
In dump() and the << operator below. This came up
| |
21 | |
20 #include <cstdint> // uintptr_t | 22 #include <cstdint> // uintptr_t |
21 #include <string> | 23 #include <string> |
22 | 24 |
23 namespace Ice { | 25 namespace Ice { |
24 | 26 |
25 class StringPool { | 27 class StringPool { |
26 StringPool(const StringPool &) = delete; | 28 StringPool(const StringPool &) = delete; |
27 StringPool &operator=(const StringPool &) = delete; | 29 StringPool &operator=(const StringPool &) = delete; |
28 | 30 |
29 public: | 31 public: |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 template <typename T> struct hash<Ice::StringID<T>> { | 167 template <typename T> struct hash<Ice::StringID<T>> { |
166 size_t operator()(const Ice::StringID<T> &Key) const { | 168 size_t operator()(const Ice::StringID<T> &Key) const { |
167 if (Key.hasStdString()) | 169 if (Key.hasStdString()) |
168 return hash<std::string>()(Key.toString()); | 170 return hash<std::string>()(Key.toString()); |
169 return hash<Ice::StringPool::IDType>()(Key.getID()); | 171 return hash<Ice::StringPool::IDType>()(Key.getID()); |
170 } | 172 } |
171 }; | 173 }; |
172 } // end of namespace std | 174 } // end of namespace std |
173 | 175 |
174 #endif // SUBZERO_SRC_ICESTRINGPOOL_H | 176 #endif // SUBZERO_SRC_ICESTRINGPOOL_H |
OLD | NEW |