[Interest] How to determine at compile time that given enum type is Q_ENUMed?
Alexey Rochev
equeim at gmail.com
Tue Aug 16 23:19:50 CEST 2022
Hello
I'm trying to specialize fmt::formatter for all Q_ENUM enums types,
and for that I need to come up with constexpr bool function/variable
template that somehow checks if Q_ENUM was declared for enum (to use
with SFINAE).
I know that QMetaEnum::fromType() fails with static_assert if Q_ENUM
is not declared for type, which means that this information is
available at compile time. But I'm not experienced enough with
templates to derive boolean constant from this (without using private
Qt internals). Is it possible to "convert" function template failing
with static_assert to boolean compile time constant (i.e. extract
condition from outside)?
More information about the Interest
mailing list