You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There might be an issue here, I'm using Git hash d66fa22 (quite recent but I could upgrade) and the support for enum class looks broken:
enum class TestEnumClass
{
A,
B,
C
};
void doSomething()
{
fmt::print("{}\n", TestEnumClass::A);
}
That prints the following error:
fmt/include/fmt/core.h:329:3: error: static assertion failed: don't know how to format the type, include fmt/ostream.h if it provides an operator<< that should be used
static_assert(internal::no_formatter_error<T>::value,
^~~~~~~~~~~~~
Classical enums work fine. It might be related to the management of convert_to_int in which std::is_convertible<T, int>::value returns false. I tried to include ostream.h, to make a custom formatter, etc., without success.
Does it ring any bell to you? Sorry if I'm missing something simple here, I'm a new user of fmt.
Thanks,
Best regards,
Louis
The text was updated successfully, but these errors were encountered:
Thank you for pointing this one, I could make it work generically using your example there (since it looks disabled by default - but I don't really want to declare all the enum class that I need to format since there are a lot):
#include <fmt/ostream.h>
template<typename T>
typename std::enable_if<std::is_enum<T>::value, std::ostream>::type &
operator<<(std::ostream& os, T const& ec) {
return os << static_cast<int>(ec);
}
Hello,
There might be an issue here, I'm using Git hash d66fa22 (quite recent but I could upgrade) and the support for enum class looks broken:
That prints the following error:
Classical enums work fine. It might be related to the management of
convert_to_int
in whichstd::is_convertible<T, int>::value
returns false. I tried to include ostream.h, to make a custom formatter, etc., without success.Does it ring any bell to you? Sorry if I'm missing something simple here, I'm a new user of fmt.
Thanks,
Best regards,
Louis
The text was updated successfully, but these errors were encountered: