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

Unified Diff: tools/gn/output_file.h

Issue 26537002: Add a UniqueVector class to GN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: REview comments, remove npos Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/ninja_binary_target_writer_unittest.cc ('k') | tools/gn/source_dir.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/output_file.h
diff --git a/tools/gn/output_file.h b/tools/gn/output_file.h
index 2e7a0ce1d76bfb6925b22396ce7a6fe791535336..252fae4492f5247e7b59e1b6f4ecf56a9bbfa8c5 100644
--- a/tools/gn/output_file.h
+++ b/tools/gn/output_file.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/containers/hash_tables.h"
#include "tools/gn/build_settings.h"
#include "tools/gn/source_file.h"
@@ -41,4 +42,25 @@ class OutputFile {
std::string value_;
};
+namespace BASE_HASH_NAMESPACE {
+
+#if defined(COMPILER_GCC)
+template<> struct hash<OutputFile> {
+ std::size_t operator()(const OutputFile& v) const {
+ hash<std::string> h;
+ return h(v.value());
+ }
+};
+#elif defined(COMPILER_MSVC)
+inline size_t hash_value(const OutputFile& v) {
+ return hash_value(v.value());
+}
+#endif // COMPILER...
+
+} // namespace BASE_HASH_NAMESPACE
+
+inline void swap(OutputFile& lhs, OutputFile& rhs) {
+ lhs.value().swap(rhs.value());
+}
+
#endif // TOOLS_GN_OUTPUT_FILE_H_
« no previous file with comments | « tools/gn/ninja_binary_target_writer_unittest.cc ('k') | tools/gn/source_dir.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698