mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Reimplement event assertions to loosen constexpr restrictions on event subtypes
Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
This commit is contained in:
parent
8f6a8316ad
commit
7d1d630457
@ -373,13 +373,13 @@ private:
|
||||
// Helper functions
|
||||
////////////////////////////////////////////////////////////
|
||||
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> || ...);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool isEventSubtype = isInParameterPack<T>(decltype(m_data)());
|
||||
static constexpr bool isEventSubtype = isInParameterPack<T>(decltype (&m_data)(nullptr));
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
Loading…
Reference in New Issue
Block a user