| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 * | 6 * |
| 7 * | 7 * |
| 8 * This header provides some of the helpers (std::integral_constant) and | 8 * This header provides some of the helpers (std::integral_constant) and |
| 9 * type transformations (std::conditional) which will become available with | 9 * type transformations (std::conditional) which will become available with |
| 10 * C++11 in the type_traits header. | 10 * C++11 in the type_traits header. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 struct Fallback { int member; };
\ | 82 struct Fallback { int member; };
\ |
| 83 struct Derived : T, Fallback {};
\ | 83 struct Derived : T, Fallback {};
\ |
| 84 template <typename U, U> struct Check;
\ | 84 template <typename U, U> struct Check;
\ |
| 85 template <typename U> static uint8_t func(Check<int Fallback::*, &U::member>
*); \ | 85 template <typename U> static uint8_t func(Check<int Fallback::*, &U::member>
*); \ |
| 86 template <typename U> static uint16_t func(...);
\ | 86 template <typename U> static uint16_t func(...);
\ |
| 87 public:
\ | 87 public:
\ |
| 88 typedef HasMember_##member type;
\ | 88 typedef HasMember_##member type;
\ |
| 89 static const bool value = sizeof(func<Derived>(NULL)) == sizeof(uint16_t);
\ | 89 static const bool value = sizeof(func<Derived>(NULL)) == sizeof(uint16_t);
\ |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Same sort of thing as SK_CREATE_MEMBER_DETECTOR, but checks for the existence
of a nested type. |
| 93 #define SK_CREATE_TYPE_DETECTOR(type) \ |
| 94 template <typename T> \ |
| 95 class HasType_##type { \ |
| 96 template <typename U> static uint8_t func(typename U::type*); \ |
| 97 template <typename U> static uint16_t func(...); \ |
| 98 public: \ |
| 99 static const bool value = sizeof(func<T>(NULL)) == sizeof(uint8_t); \ |
| 100 } |
| 101 |
| 92 #endif | 102 #endif |
| OLD | NEW |