From be84ff4f2c721956254a2ff10ae86030c84df21d Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 16 Mar 2025 17:08:40 -0600 Subject: [PATCH] AK: Add cast using objective-c __bridge qualifier --- AK/TypeCasts.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AK/TypeCasts.h b/AK/TypeCasts.h index bd55da03d1a..5c95fb3ff23 100644 --- a/AK/TypeCasts.h +++ b/AK/TypeCasts.h @@ -73,10 +73,21 @@ ALWAYS_INLINE CopyConst* as(InputType* input) return result; } +template +ALWAYS_INLINE CopyConst* bridge_cast(InputType input) +{ +#ifdef AK_HAS_OBJC_ARC + return (__bridge CopyConst*)(input); +#else + return static_cast*>(input); +#endif +} + } #if USING_AK_GLOBALLY using AK::as; using AK::as_if; +using AK::bridge_cast; using AK::is; #endif