5#ifndef INCLUDE_CPPGC_TYPE_TRAITS_H_
6#define INCLUDE_CPPGC_TYPE_TRAITS_H_
18template <
typename T,
typename WeaknessTag,
typename WriteBarrierPolicy,
19 typename CheckingPolicy,
typename StorageType>
21struct DijkstraWriteBarrierPolicy;
22struct NoWriteBarrierPolicy;
24class UntracedMemberTag;
33template <
typename T,
typename =
void>
38 std::declval<Visitor*>()))>> : std::true_type {
41template <
typename T,
typename =
void>
43 static_assert(
sizeof(T),
"T must be fully defined");
48 T, std::void_t<decltype(std::declval<T>().Trace(std::declval<Visitor*>()))>>
54 "Trace methods should be marked as const.");
60template <
typename T,
typename =
void>
62 static_assert(
sizeof(T),
"T must be fully defined");
68 typename std::remove_const_t<T>::IsGarbageCollectedMixinTypeMarker>>
70 static_assert(
sizeof(T),
"T must be fully defined");
73template <
typename T,
typename =
void>
75 static_assert(
sizeof(T),
"T must be fully defined");
81 std::void_t<typename std::remove_const_t<T>::IsGarbageCollectedTypeMarker>>
83 static_assert(
sizeof(T),
"T must be fully defined");
86template <typename T, bool = HasGarbageCollectedTypeMarker<T>::value,
89 static_assert(
sizeof(T),
"T must be fully defined");
94 static_assert(
sizeof(T),
"T must be fully defined");
97template <typename T, bool = HasGarbageCollectedTypeMarker<T>::value>
99 static_assert(
sizeof(T),
"T must be fully defined");
104 static_assert(
sizeof(T),
"T must be fully defined");
109 : std::integral_constant<bool, IsGarbageCollectedType<T>::value ||
110 IsGarbageCollectedMixinType<T>::value> {
111 static_assert(
sizeof(T),
"T must be fully defined");
114template <
typename T,
bool = (HasGarbageCollectedTypeMarker<T>::value &&
115 HasGarbageCollectedMixinTypeMarker<T>::value)>
117 static_assert(
sizeof(T),
"T must be fully defined");
122 static_assert(
sizeof(T),
"T must be fully defined");
125template <
typename BasicMemberCandidate,
typename WeaknessTag,
126 typename WriteBarrierPolicy>
129 template <
typename T,
typename CheckingPolicy,
typename StorageType>
130 static std::true_type SubclassCheck(
131 const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
133 static std::false_type SubclassCheck(...);
136 static constexpr bool value =
decltype(SubclassCheck(
137 std::declval<std::decay_t<BasicMemberCandidate>*>()))
::value;
165 template <
typename U,
size_t = sizeof(U)>
166 static std::true_type IsSizeOfKnown(U*);
167 static std::false_type IsSizeOfKnown(...);
171 decltype(IsSizeOfKnown(std::declval<T*>()))
::value;
174template <
typename T,
typename U>
176 std::is_same_v<std::decay_t<T>, std::decay_t<U>>;
178template <
typename B,
typename D>
180 std::is_base_of_v<std::decay_t<B>, std::decay_t<D>> &&
181 !IsDecayedSameV<B, D>;
186template <
typename T,
typename WeaknessTag,
typename WriteBarrierPolicy,
187 typename CheckingPolicy,
typename StorageType>
189 T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy, StorageType>> =
true;
261 IsMemberTypeV<T> || IsWeakMemberTypeV<T>;
constexpr bool IsStrictlyBaseOfV
Definition: type-traits.h:179
constexpr bool IsDecayedSameV
Definition: type-traits.h:175
constexpr bool IsAnyMemberTypeV
Definition: type-traits.h:184
constexpr bool IsTraceableV
Definition: type-traits.h:58
Definition: allocation.h:38
constexpr bool IsGarbageCollectedOrMixinTypeV
Definition: type-traits.h:214
constexpr bool IsMemberTypeV
Definition: type-traits.h:229
constexpr bool IsCompleteV
Definition: type-traits.h:254
constexpr bool IsWeakMemberTypeV
Definition: type-traits.h:241
constexpr bool IsGarbageCollectedTypeV
Definition: type-traits.h:206
constexpr bool IsWeakV
Definition: type-traits.h:248
constexpr bool IsMemberOrWeakMemberTypeV
Definition: type-traits.h:260
constexpr bool IsGarbageCollectedWithMixinTypeV
Definition: type-traits.h:222
constexpr bool IsUntracedMemberTypeV
Definition: type-traits.h:235
constexpr bool IsAnyMemberTypeV
Definition: type-traits.h:267
constexpr bool IsGarbageCollectedMixinTypeV
Definition: type-traits.h:198
Definition: pointer-policies.h:30
Definition: type-traits.h:61
Definition: type-traits.h:74
Definition: type-traits.h:163
static constexpr bool value
Definition: type-traits.h:170
Definition: type-traits.h:88
Definition: type-traits.h:110
Definition: type-traits.h:98
Definition: type-traits.h:116
Definition: type-traits.h:143
Definition: type-traits.h:127
static constexpr bool value
Definition: type-traits.h:136
Definition: type-traits.h:34
Definition: type-traits.h:42
Definition: type-traits.h:157
Definition: type-traits.h:150
Definition: type-traits.h:29
Definition: pointer-policies.h:108