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 6d2562f1b585fa710d9cf892776c721f9b29f4dc..6786d4dfc828390a0713bcec1dc192e16b552564 100644 |
| --- a/mojo/public/cpp/bindings/lib/bindings_internal.h |
| +++ b/mojo/public/cpp/bindings/lib/bindings_internal.h |
| @@ -94,6 +94,8 @@ struct IsHandle { |
| template <typename T> |
| struct IsUnionDataType { |
| + typedef char (*EnsureTypeIsComplete)[sizeof(T)]; |
|
Ken Rockot(use gerrit already)
2016/01/26 15:39:20
nit: any reason not to use a c++11 alias here and
yzshen1
2016/01/26 18:16:04
Done. I also refactored a little bit. Thanks!
|
| + |
| template <typename U> |
| static YesType Test(const typename U::MojomUnionDataType*); |
| @@ -104,6 +106,20 @@ struct IsUnionDataType { |
| sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value; |
| }; |
| +template <typename T> |
| +struct IsEnumDataType { |
| + typedef char (*EnsureTypeIsComplete)[sizeof(T)]; |
| + |
| + template <typename U> |
| + static YesType Test(const typename U::MojomEnumDataType*); |
| + |
| + template <typename U> |
| + static NoType Test(...); |
| + |
| + static const bool value = |
| + sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value; |
| +}; |
| + |
| template <typename T, bool move_only = IsMoveOnlyType<T>::value> |
| struct WrapperTraits; |