-
-
Notifications
You must be signed in to change notification settings - Fork 2k
AK: Use Deducing this for OptionalBase #5447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@Hendiadyoin1 CI is failing :-( |
Yeah, probably need to bump the ci compiler version |
If it doesn't build with Xcode 16.3 clang, we're gonna have to hold off on this. @BertalanD , wanna try this out on the latest Xcode 26 preview? Looks like beta 3 came out a week ago |
83c80fa
to
d1b9c5f
Compare
Ah whoops mainly forgot to remove a now superfluous thing |
Can confirm that Xcode 26 beta 3 (clang-1700.3.13.4) successfully builds this. |
d1b9c5f
to
0a10814
Compare
Head branch was pushed to by a user without write access
0a10814
to
55fa503
Compare
This is taken from and akin to SerenityOS/serenity#25894
55fa503
to
b7aafb5
Compare
@@ -32,10 +36,17 @@ struct ConditionallyResultType<false, T> { | |||
using Type = T; | |||
}; | |||
|
|||
template<typename Self, typename T> | |||
struct AddConstIfNeeded { | |||
using Type = Conditional<IsConst<RemoveReference<Self>> && !IsConst<T>, AddConst<T>, T>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 what's the point of this? AddConst<T const>
is just T const
anyway
This name is really confusing, I think the intent is CopyConst<RemoveReference<Self>, T>
but to keep T = U const
as const if Self
isn't const?
regardless the && !IsConst<T>
is unnecessary, AddConst is idempotent for T const.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good looked at AddConst
and did not see any special handling for T const
, good to know that it is idempotent anyway
And yes this is supposed to be CopyConstButDontRemoveItPls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a different name then, AddConstFrom<F, T>
maybe?
template<typename From, typename To>
struct AddConstFrom {
using Type = Conditional<IsConst<RemoveReference<From>>, T, AddConst<T>>;
};
the RemoveReference bit seems a bit odd to me, but probably okay.
This is taken from and akin to
SerenityOS/serenity#25894
This greatly reduces the code duplication and is a bit more strict about forwarding