From b1e99db2a408acd2523d97c23f9cae3409f497ce Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 19 Jun 2022 18:20:42 +0200 Subject: [PATCH] Core/Util: ported Coalesce template --- src/common/Utilities/Util.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index c5f95311536..cc2bfa879db 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -526,4 +526,16 @@ constexpr typename std::underlying_type::type AsUnderlyingType(E enumValue) return static_cast::type>(enumValue); } +template +Ret* Coalesce(Only* arg) +{ + return arg; +} + +template +Ret* Coalesce(T1* first, T*... rest) +{ + return static_cast(first ? static_cast(first) : Coalesce(rest...)); +} + #endif