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 IsTraceableV
constexpr bool IsAnyMemberTypeV
constexpr bool IsDecayedSameV
constexpr bool IsStrictlyBaseOfV
constexpr bool IsAnyMemberTypeV
constexpr bool IsGarbageCollectedTypeV
constexpr bool IsGarbageCollectedOrMixinTypeV
constexpr bool IsMemberOrWeakMemberTypeV
constexpr bool IsWeakMemberTypeV
constexpr bool IsCompleteV
constexpr bool IsGarbageCollectedMixinTypeV
constexpr bool IsGarbageCollectedWithMixinTypeV
constexpr bool IsUntracedMemberTypeV
constexpr bool IsMemberTypeV
static constexpr bool value
static constexpr bool value