OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
| 11 #include <type_traits> |
11 | 12 |
12 #include "base/template_util.h" | |
13 #include "mojo/public/cpp/bindings/interface_id.h" | 13 #include "mojo/public/cpp/bindings/interface_id.h" |
14 #include "mojo/public/cpp/bindings/lib/template_util.h" | 14 #include "mojo/public/cpp/bindings/lib/template_util.h" |
15 #include "mojo/public/cpp/system/core.h" | 15 #include "mojo/public/cpp/system/core.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 | 18 |
19 template <typename T> | 19 template <typename T> |
20 class ArrayDataView; | 20 class ArrayDataView; |
21 | 21 |
22 template <typename T> | 22 template <typename T> |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 struct BelongsTo { | 318 struct BelongsTo { |
319 static const bool value = | 319 static const bool value = |
320 static_cast<uint32_t>(MojomTypeTraits<T>::category & categories) != 0; | 320 static_cast<uint32_t>(MojomTypeTraits<T>::category & categories) != 0; |
321 }; | 321 }; |
322 | 322 |
323 template <typename T> | 323 template <typename T> |
324 struct EnumHashImpl { | 324 struct EnumHashImpl { |
325 static_assert(std::is_enum<T>::value, "Incorrect hash function."); | 325 static_assert(std::is_enum<T>::value, "Incorrect hash function."); |
326 | 326 |
327 size_t operator()(T input) const { | 327 size_t operator()(T input) const { |
328 using UnderlyingType = typename base::underlying_type<T>::type; | 328 using UnderlyingType = typename std::underlying_type<T>::type; |
329 return std::hash<UnderlyingType>()(static_cast<UnderlyingType>(input)); | 329 return std::hash<UnderlyingType>()(static_cast<UnderlyingType>(input)); |
330 } | 330 } |
331 }; | 331 }; |
332 | 332 |
333 } // namespace internal | 333 } // namespace internal |
334 } // namespace mojo | 334 } // namespace mojo |
335 | 335 |
336 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 336 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
OLD | NEW |