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_FILE_H_ | 5 #ifndef TOOLS_GN_SOURCE_FILE_H_ |
6 #define TOOLS_GN_SOURCE_FILE_H_ | 6 #define TOOLS_GN_SOURCE_FILE_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 private: | 83 private: |
84 friend class SourceDir; | 84 friend class SourceDir; |
85 | 85 |
86 std::string value_; | 86 std::string value_; |
87 | 87 |
88 // Copy & assign supported. | 88 // Copy & assign supported. |
89 }; | 89 }; |
90 | 90 |
91 namespace BASE_HASH_NAMESPACE { | 91 namespace BASE_HASH_NAMESPACE { |
92 | 92 |
93 #if defined(COMPILER_GCC) | |
94 template<> struct hash<SourceFile> { | 93 template<> struct hash<SourceFile> { |
95 std::size_t operator()(const SourceFile& v) const { | 94 std::size_t operator()(const SourceFile& v) const { |
96 hash<std::string> h; | 95 hash<std::string> h; |
97 return h(v.value()); | 96 return h(v.value()); |
98 } | 97 } |
99 }; | 98 }; |
100 #elif defined(COMPILER_MSVC) | |
101 inline size_t hash_value(const SourceFile& v) { | |
102 return hash_value(v.value()); | |
103 } | |
104 #endif // COMPILER... | |
105 | 99 |
106 } // namespace BASE_HASH_NAMESPACE | 100 } // namespace BASE_HASH_NAMESPACE |
107 | 101 |
108 inline void swap(SourceFile& lhs, SourceFile& rhs) { | 102 inline void swap(SourceFile& lhs, SourceFile& rhs) { |
109 lhs.swap(rhs); | 103 lhs.swap(rhs); |
110 } | 104 } |
111 | 105 |
112 #endif // TOOLS_GN_SOURCE_FILE_H_ | 106 #endif // TOOLS_GN_SOURCE_FILE_H_ |
OLD | NEW |