diff options
author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2020-04-09 09:59:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 11:59:10 +0200 |
commit | 90b00288c24dfefccb338bd33b025cf85e82076d (patch) | |
tree | dd5d5f0f8c77abeac0de4939801233f48f960c35 /src/common/Utilities/Util.h | |
parent | 64246306678c12024f401c2c1934a8b452057452 (diff) |
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
Diffstat (limited to 'src/common/Utilities/Util.h')
-rw-r--r-- | src/common/Utilities/Util.h | 12 |
1 files changed, 12 insertions, 0 deletions
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<E>::type AsUnderlyingType(E enumValue) return static_cast<typename std::underlying_type<E>::type>(enumValue); } +template<typename Ret, typename Only> +Ret* Coalesce(Only* arg) +{ + return arg; +} + +template<typename Ret, typename T1, typename... T> +Ret* Coalesce(T1* first, T*... rest) +{ + return static_cast<Ret*>(first ? static_cast<Ret*>(first) : Coalesce<Ret>(rest...)); +} + #endif |