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

Unified Diff: mojo/public/cpp/bindings/lib/bindings_internal.h

Issue 2136733002: Mojo C++ bindings: add a new mode to generator to use native STL/WTF types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@67_new
Patch Set: . Created 4 years, 5 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 | « mojo/public/cpp/bindings/array_traits_stl.h ('k') | mojo/public/cpp/bindings/lib/clone_equals_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/bindings_internal.h
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h
index b32cf694b9e62ed5b47d8e4c382643b74f108eec..b37d87273f7b7aab715177084a3962731300250c 100644
--- a/mojo/public/cpp/bindings/lib/bindings_internal.h
+++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -7,6 +7,9 @@
#include <stdint.h>
+#include <functional>
+
+#include "base/template_util.h"
#include "mojo/public/cpp/bindings/interface_id.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
#include "mojo/public/cpp/system/core.h"
@@ -315,6 +318,16 @@ struct BelongsTo {
static_cast<uint32_t>(MojomTypeTraits<T>::category & categories) != 0;
};
+template <typename T>
+struct EnumHashImpl {
+ static_assert(std::is_enum<T>::value, "Incorrect hash function.");
+
+ size_t operator()(T input) const {
+ using UnderlyingType = typename base::underlying_type<T>::type;
+ return std::hash<UnderlyingType>()(static_cast<UnderlyingType>(input));
+ }
+};
+
} // namespace internal
} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/array_traits_stl.h ('k') | mojo/public/cpp/bindings/lib/clone_equals_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698