Reimplement event assertions to loosen constexpr restrictions on event subtypes

Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
This commit is contained in:
Chris Thrasher 2024-08-21 10:15:33 -06:00
parent 8f6a8316ad
commit 7d1d630457

View File

@ -373,13 +373,13 @@ private:
// Helper functions // Helper functions
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename T, typename... Ts> template <typename T, typename... Ts>
[[nodiscard]] static constexpr bool isInParameterPack(const std::variant<Ts...>&) [[nodiscard]] static constexpr bool isInParameterPack(const std::variant<Ts...>*)
{ {
return (std::is_same_v<T, Ts> || ...); return (std::is_same_v<T, Ts> || ...);
} }
template <typename T> template <typename T>
static constexpr bool isEventSubtype = isInParameterPack<T>(decltype(m_data)()); static constexpr bool isEventSubtype = isInParameterPack<T>(decltype (&m_data)(nullptr));
}; };
} // namespace sf } // namespace sf