Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/node/cppgc/type-traits.h
$ cat -n /usr/include/node/cppgc/type-traits.h 1 // Copyright 2020 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef INCLUDE_CPPGC_TYPE_TRAITS_H_ 6 #define INCLUDE_CPPGC_TYPE_TRAITS_H_ 7 8 // This file should stay with minimal dependencies to allow embedder to check 9 // against Oilpan types without including any other parts. 10 #include
11 #include
12 13 namespace cppgc { 14 15 class Visitor; 16 17 namespace internal { 18 template
20 class BasicMember; 21 struct DijkstraWriteBarrierPolicy; 22 struct NoWriteBarrierPolicy; 23 class StrongMemberTag; 24 class UntracedMemberTag; 25 class WeakMemberTag; 26 27 // Not supposed to be specialized by the user. 28 template
29 struct IsWeak : std::false_type {}; 30 31 // IsTraceMethodConst is used to verify that all Trace methods are marked as 32 // const. It is equivalent to IsTraceable but for a non-const object. 33 template
34 struct IsTraceMethodConst : std::false_type {}; 35 36 template
37 struct IsTraceMethodConst
().Trace( 38 std::declval
()))>> : std::true_type { 39 }; 40 41 template
42 struct IsTraceable : std::false_type { 43 static_assert(sizeof(T), "T must be fully defined"); 44 }; 45 46 template
47 struct IsTraceable< 48 T, std::void_t
().Trace(std::declval
()))>> 49 : std::true_type { 50 // All Trace methods should be marked as const. If an object of type 51 // 'T' is traceable then any object of type 'const T' should also 52 // be traceable. 53 static_assert(IsTraceMethodConst
(), 54 "Trace methods should be marked as const."); 55 }; 56 57 template
58 constexpr bool IsTraceableV = IsTraceable
::value; 59 60 template
61 struct HasGarbageCollectedMixinTypeMarker : std::false_type { 62 static_assert(sizeof(T), "T must be fully defined"); 63 }; 64 65 template
66 struct HasGarbageCollectedMixinTypeMarker< 67 T, std::void_t< 68 typename std::remove_const_t
::IsGarbageCollectedMixinTypeMarker>> 69 : std::true_type { 70 static_assert(sizeof(T), "T must be fully defined"); 71 }; 72 73 template
74 struct HasGarbageCollectedTypeMarker : std::false_type { 75 static_assert(sizeof(T), "T must be fully defined"); 76 }; 77 78 template
79 struct HasGarbageCollectedTypeMarker< 80 T, 81 std::void_t
::IsGarbageCollectedTypeMarker>> 82 : std::true_type { 83 static_assert(sizeof(T), "T must be fully defined"); 84 }; 85 86 template
::value, 87 bool = HasGarbageCollectedMixinTypeMarker
::value> 88 struct IsGarbageCollectedMixinType : std::false_type { 89 static_assert(sizeof(T), "T must be fully defined"); 90 }; 91 92 template
93 struct IsGarbageCollectedMixinType
: std::true_type { 94 static_assert(sizeof(T), "T must be fully defined"); 95 }; 96 97 template
::value> 98 struct IsGarbageCollectedType : std::false_type { 99 static_assert(sizeof(T), "T must be fully defined"); 100 }; 101 102 template
103 struct IsGarbageCollectedType
: std::true_type { 104 static_assert(sizeof(T), "T must be fully defined"); 105 }; 106 107 template
108 struct IsGarbageCollectedOrMixinType 109 : std::integral_constant
::value || 110 IsGarbageCollectedMixinType
::value> { 111 static_assert(sizeof(T), "T must be fully defined"); 112 }; 113 114 template
::value && 115 HasGarbageCollectedMixinTypeMarker
::value)> 116 struct IsGarbageCollectedWithMixinType : std::false_type { 117 static_assert(sizeof(T), "T must be fully defined"); 118 }; 119 120 template
121 struct IsGarbageCollectedWithMixinType
: std::true_type { 122 static_assert(sizeof(T), "T must be fully defined"); 123 }; 124 125 template
127 struct IsSubclassOfBasicMemberTemplate { 128 private: 129 template
130 static std::true_type SubclassCheck( 131 const BasicMember
*); 133 static std::false_type SubclassCheck(...); 134 135 public: 136 static constexpr bool value = decltype(SubclassCheck( 137 std::declval
*>()))::value; 138 }; 139 140 template
::value> 143 struct IsMemberType : std::false_type {}; 144 145 template
146 struct IsMemberType
: std::true_type {}; 147 148 template
::value> 150 struct IsWeakMemberType : std::false_type {}; 151 152 template
153 struct IsWeakMemberType
: std::true_type {}; 154 155 template
::value> 157 struct IsUntracedMemberType : std::false_type {}; 158 159 template
160 struct IsUntracedMemberType
: std::true_type {}; 161 162 template
163 struct IsComplete { 164 private: 165 template
166 static std::true_type IsSizeOfKnown(U*); 167 static std::false_type IsSizeOfKnown(...); 168 169 public: 170 static constexpr bool value = 171 decltype(IsSizeOfKnown(std::declval
()))::value; 172 }; 173 174 template
175 constexpr bool IsDecayedSameV = 176 std::is_same_v
, std::decay_t
>; 177 178 template
179 constexpr bool IsStrictlyBaseOfV = 180 std::is_base_of_v
, std::decay_t
> && 181 !IsDecayedSameV
; 182 183 template
184 constexpr bool IsAnyMemberTypeV = false; 185 186 template
188 constexpr bool IsAnyMemberTypeV
> = true; 190 191 } // namespace internal 192 193 /** 194 * Value is true for types that inherit from `GarbageCollectedMixin` but not 195 * `GarbageCollected
` (i.e., they are free mixins), and false otherwise. 196 */ 197 template
198 constexpr bool IsGarbageCollectedMixinTypeV = 199 internal::IsGarbageCollectedMixinType
::value; 200 201 /** 202 * Value is true for types that inherit from `GarbageCollected
`, and false 203 * otherwise. 204 */ 205 template
206 constexpr bool IsGarbageCollectedTypeV = 207 internal::IsGarbageCollectedType
::value; 208 209 /** 210 * Value is true for types that inherit from either `GarbageCollected
` or 211 * `GarbageCollectedMixin`, and false otherwise. 212 */ 213 template
214 constexpr bool IsGarbageCollectedOrMixinTypeV = 215 internal::IsGarbageCollectedOrMixinType
::value; 216 217 /** 218 * Value is true for types that inherit from `GarbageCollected
` and 219 * `GarbageCollectedMixin`, and false otherwise. 220 */ 221 template
222 constexpr bool IsGarbageCollectedWithMixinTypeV = 223 internal::IsGarbageCollectedWithMixinType
::value; 224 225 /** 226 * Value is true for types of type `Member
`, and false otherwise. 227 */ 228 template
229 constexpr bool IsMemberTypeV = internal::IsMemberType
::value; 230 231 /** 232 * Value is true for types of type `UntracedMember
`, and false otherwise. 233 */ 234 template
235 constexpr bool IsUntracedMemberTypeV = internal::IsUntracedMemberType
::value; 236 237 /** 238 * Value is true for types of type `WeakMember
`, and false otherwise. 239 */ 240 template
241 constexpr bool IsWeakMemberTypeV = internal::IsWeakMemberType
::value; 242 243 /** 244 * Value is true for types that are considered weak references, and false 245 * otherwise. 246 */ 247 template
248 constexpr bool IsWeakV = internal::IsWeak
::value; 249 250 /** 251 * Value is true for types that are complete, and false otherwise. 252 */ 253 template
254 constexpr bool IsCompleteV = internal::IsComplete
::value; 255 256 /** 257 * Value is true for member types `Member
` and `WeakMember
`. 258 */ 259 template
260 constexpr bool IsMemberOrWeakMemberTypeV = 261 IsMemberTypeV
|| IsWeakMemberTypeV
; 262 263 /** 264 * Value is true for any member type. 265 */ 266 template
267 constexpr bool IsAnyMemberTypeV = internal::IsAnyMemberTypeV
>; 268 269 } // namespace cppgc 270 271 #endif // INCLUDE_CPPGC_TYPE_TRAITS_H_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2026 MyWebUniversity.com ™