| 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_OUTPUT_FILE_H_ | 5 #ifndef TOOLS_GN_OUTPUT_FILE_H_ |
| 6 #define TOOLS_GN_OUTPUT_FILE_H_ | 6 #define TOOLS_GN_OUTPUT_FILE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 bool operator<(const OutputFile& other) const { | 40 bool operator<(const OutputFile& other) const { |
| 41 return value_ < other.value_; | 41 return value_ < other.value_; |
| 42 } | 42 } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 std::string value_; | 45 std::string value_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 namespace BASE_HASH_NAMESPACE { | 48 namespace BASE_HASH_NAMESPACE { |
| 49 | 49 |
| 50 #if defined(COMPILER_GCC) | |
| 51 template<> struct hash<OutputFile> { | 50 template<> struct hash<OutputFile> { |
| 52 std::size_t operator()(const OutputFile& v) const { | 51 std::size_t operator()(const OutputFile& v) const { |
| 53 hash<std::string> h; | 52 hash<std::string> h; |
| 54 return h(v.value()); | 53 return h(v.value()); |
| 55 } | 54 } |
| 56 }; | 55 }; |
| 57 #elif defined(COMPILER_MSVC) | |
| 58 inline size_t hash_value(const OutputFile& v) { | |
| 59 return hash_value(v.value()); | |
| 60 } | |
| 61 #endif // COMPILER... | |
| 62 | 56 |
| 63 } // namespace BASE_HASH_NAMESPACE | 57 } // namespace BASE_HASH_NAMESPACE |
| 64 | 58 |
| 65 inline void swap(OutputFile& lhs, OutputFile& rhs) { | 59 inline void swap(OutputFile& lhs, OutputFile& rhs) { |
| 66 lhs.value().swap(rhs.value()); | 60 lhs.value().swap(rhs.value()); |
| 67 } | 61 } |
| 68 | 62 |
| 69 #endif // TOOLS_GN_OUTPUT_FILE_H_ | 63 #endif // TOOLS_GN_OUTPUT_FILE_H_ |
| OLD | NEW |