| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TEMPLATE_UTIL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_ |
| 7 | 7 |
| 8 namespace mojo { | 8 namespace mojo { |
| 9 namespace internal { | 9 namespace internal { |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 static Derived* CreateDerived(); | 93 static Derived* CreateDerived(); |
| 94 static char(&Check(Base*))[1]; | 94 static char(&Check(Base*))[1]; |
| 95 static char(&Check(...))[2]; | 95 static char(&Check(...))[2]; |
| 96 | 96 |
| 97 public: | 97 public: |
| 98 static bool const value = sizeof Check(CreateDerived()) == 1 && | 98 static bool const value = sizeof Check(CreateDerived()) == 1 && |
| 99 !IsSame<Base const, void const>::value; | 99 !IsSame<Base const, void const>::value; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 template <class T> | 102 template <class T> |
| 103 struct RemovePointer {}; | 103 struct RemovePointer { |
| 104 typedef T type; |
| 105 }; |
| 104 template <class T> | 106 template <class T> |
| 105 struct RemovePointer<T*> { | 107 struct RemovePointer<T*> { |
| 106 typedef T type; | 108 typedef T type; |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 template <template <typename...> class Template, typename T> | 111 template <template <typename...> class Template, typename T> |
| 110 struct IsSpecializationOf : FalseType {}; | 112 struct IsSpecializationOf : FalseType {}; |
| 111 | 113 |
| 112 template <template <typename...> class Template, typename... Args> | 114 template <template <typename...> class Template, typename... Args> |
| 113 struct IsSpecializationOf<Template, Template<Args...>> : TrueType {}; | 115 struct IsSpecializationOf<Template, Template<Args...>> : TrueType {}; |
| 114 | 116 |
| 115 template <bool B, typename T, typename F> | 117 template <bool B, typename T, typename F> |
| 116 struct Conditional { | 118 struct Conditional { |
| 117 typedef T type; | 119 typedef T type; |
| 118 }; | 120 }; |
| 119 | 121 |
| 120 template <typename T, typename F> | 122 template <typename T, typename F> |
| 121 struct Conditional<false, T, F> { | 123 struct Conditional<false, T, F> { |
| 122 typedef F type; | 124 typedef F type; |
| 123 }; | 125 }; |
| 124 | 126 |
| 125 } // namespace internal | 127 } // namespace internal |
| 126 } // namespace mojo | 128 } // namespace mojo |
| 127 | 129 |
| 128 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_ | 130 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_ |
| OLD | NEW |