Chromium Code Reviews| 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..7c3257ed6da23e087ee743b3b030deebd29841f8 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,14 @@ struct BelongsTo { |
| static_cast<uint32_t>(MojomTypeTraits<T>::category & categories) != 0; |
| }; |
| +template <typename T> |
|
dcheng
2016/07/12 04:19:42
Nit: maybe static_assert that is_enum<T> is true,
yzshen1
2016/07/12 16:29:20
Done.
|
| +struct EnumHashImpl { |
| + 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 |