Kinda figured out how to do this: ``` template<typename T, typename = void> inline constexpr bool isQEnum = false;
template<typename T> inline constexpr bool isQEnum<T, std::void_t<decltype(qt_getEnumMetaObject(std::declval<T>()))>> = true; ``` It's not the best approach since it uses undocumented Q_ENUM internals, but it's probably stable (I'm not sure if qt_getEnumMetaObject functions are part of ABI though). ср, 17 авг. 2022 г. в 00:19, Alexey Rochev <equ...@gmail.com>: > > 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)? _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest