OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef TOOLS_GN_SOURCE_DIR_H_ | 5 #ifndef TOOLS_GN_SOURCE_DIR_H_ |
6 #define TOOLS_GN_SOURCE_DIR_H_ | 6 #define TOOLS_GN_SOURCE_DIR_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 86 matching lines...) Loading... |
97 | 97 |
98 private: | 98 private: |
99 friend class SourceFile; | 99 friend class SourceFile; |
100 std::string value_; | 100 std::string value_; |
101 | 101 |
102 // Copy & assign supported. | 102 // Copy & assign supported. |
103 }; | 103 }; |
104 | 104 |
105 namespace BASE_HASH_NAMESPACE { | 105 namespace BASE_HASH_NAMESPACE { |
106 | 106 |
107 #if defined(COMPILER_GCC) | |
108 template<> struct hash<SourceDir> { | 107 template<> struct hash<SourceDir> { |
109 std::size_t operator()(const SourceDir& v) const { | 108 std::size_t operator()(const SourceDir& v) const { |
110 hash<std::string> h; | 109 hash<std::string> h; |
111 return h(v.value()); | 110 return h(v.value()); |
112 } | 111 } |
113 }; | 112 }; |
114 #elif defined(COMPILER_MSVC) | |
115 inline size_t hash_value(const SourceDir& v) { | |
116 return hash_value(v.value()); | |
117 } | |
118 #endif // COMPILER... | |
119 | 113 |
120 } // namespace BASE_HASH_NAMESPACE | 114 } // namespace BASE_HASH_NAMESPACE |
121 | 115 |
122 inline void swap(SourceDir& lhs, SourceDir& rhs) { | 116 inline void swap(SourceDir& lhs, SourceDir& rhs) { |
123 lhs.swap(rhs); | 117 lhs.swap(rhs); |
124 } | 118 } |
125 | 119 |
126 #endif // TOOLS_GN_SOURCE_DIR_H_ | 120 #endif // TOOLS_GN_SOURCE_DIR_H_ |
OLD | NEW |