-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including fmt/ranges.h and magic_enum/magic_enum_format.hpp fails to compile #379
Comments
Possibly related to fmtlib/fmt#4058? Unfortunately my templating isn't strong enough to figure this out definitively; I tried adding the following but it didn't work:
As for the local compiler error I'm seeing, it's as follows (trimmed for brevity):
|
So after a discussion with the author of fmt, I've worked out the following which appears to work:
I'm not confident this is necessarily the most optimal implementation, but I'm happy to upstream it if so desired. The author of fmt has also made it clear that such weakly constrained specializations are considered poor practice. However, given the need to format many enums across namespaces, I'm not necessarily against continuing to include this in magic_enum. |
Hi, please test #382 |
Thanks, starting testing now. |
Unfortunately this is not working for me; the formatter is not always detected.
I can see about providing a more minimal example if necessary. |
@edelmanjm for me locally work, so I'll ask you to test it again (I update #382) |
I believe that's working! I'll do a bit more in-depth testing to confirm. |
(Ported from a comment on #298)
Including both headers appears to result in a compiler error.
On Godbolt this appears to be a
magic_enum requires enum implementation and valid max and min.
(even though the default max and min should be sufficient, and it compiles fine as long asfmt/ranges.h
isn't included)On my local compiler with a more complex example, I get an ambiguous function error with the enum template showing as valid for a non-enum type (
std:vector<std::byte>
). I suspect this is closer to the actual error.Here's the failing example: with both
#include <fmt/ranges.h>
and#include <magic_enum/magic_enum_format.hpp>
, I get a compiler error.Removing
#include <fmt/ranges.h>
allows it to compileRemoving
#include <magic_enum/magic_enum_format.hpp>
also allows it to compileThe text was updated successfully, but these errors were encountered: