From 90b00288c24dfefccb338bd33b025cf85e82076d Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Thu, 9 Apr 2020 09:59:10 +0000 Subject: Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects (#24416) * Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects * Include new Coalesce(..) template by @Shauren --- src/common/Utilities/Util.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/common/Utilities/Util.h') diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index 4915df56477..866e01e7bf6 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -519,4 +519,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 -- cgit v1.2.3