Skip to content
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

Overloaded std::ostream operators for enum types are not being used by spdlog #150

Closed
razorx89 opened this issue Nov 23, 2015 · 5 comments
Closed

Comments

@razorx89
Copy link

If someone tries to implement output operators for enum types (for much more informative output) then spdlog just implicitly casts the enum to int and gives the operator no chance. This can be fixed by changing the IsConvertibleToInt type trait.

enum { value = !std::is_enum::value && (sizeof(convert(get())) == sizeof(yes)) };

@vitaut
Copy link

vitaut commented Nov 24, 2015

This is a C++ Format issue so I opened an issue there: fmtlib/fmt#232.

@vitaut
Copy link

vitaut commented Nov 24, 2015

The issue has been fixed in C++ Format (fmtlib/fmt@6cff6d8), but the spdlog's copy has to be updated for this to have effect.

@gabime
Copy link
Owner

gabime commented Nov 26, 2015

Updated.. Thanks @vitaut

@gabime gabime closed this as completed Nov 26, 2015
@razorx89
Copy link
Author

Updated version works fine. Thanks

@aCuria
Copy link

aCuria commented May 13, 2022

So how do i get this to work as the user?
cout << enum works but
spdlog::error("{}" My_ENUM} does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants