Closed Timple closed 1 year ago
Good day
Unfortunately we cannot leverage the power of std::format just yet as we're stuck on ubuntu 22.04 for now.
std::format
However, libfmt is the predecesor of this format. Supporting this can be done easily with this snippet:
#include <fmt/format.h> #include <magic_enum.hpp> template <typename E> struct fmt::formatter<E, std::enable_if_t<std::is_enum_v<E>, char>> : fmt::formatter<std::string_view, char> { auto format(E e, format_context& ctx) { return formatter<string_view>::format(magic_enum::enum_name(e), ctx); } };
Could this perhaps be included in this wonderful library? Similar to the std::format perhaps?
added in master
Awesome! Thanks for the quick update and for the continued maintenance of this project!
Good day
Unfortunately we cannot leverage the power of
std::format
just yet as we're stuck on ubuntu 22.04 for now.However, libfmt is the predecesor of this format. Supporting this can be done easily with this snippet:
Could this perhaps be included in this wonderful library? Similar to the
std::format
perhaps?