Skip to content

Commit

Permalink
Provides compatibilities for spdlog which internally uses fmt::format…
Browse files Browse the repository at this point in the history
… instead of std::format.
  • Loading branch information
refvalue committed Nov 13, 2024
1 parent 66c8d7b commit a98ff88
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/essence/format_remediation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,18 @@ struct ES_FMT_NS::formatter<essence::basic_zstring_view<CharT, Traits>, CharT>
}
};

// Provides compatibilities for spdlog which internally uses fmt::format instead of std::format.
#ifdef ES_WITH_STD_FORMAT
template <typename CharT, typename Traits>
struct fmt::formatter<essence::basic_zstring_view<CharT, Traits>, CharT>
: formatter<std::basic_string_view<CharT, Traits>, CharT> {
template <typename FormatContext>
auto format(essence::basic_zstring_view<CharT, Traits> str, FormatContext& ctx) const {
return formatter<std::basic_string_view<CharT, Traits>, CharT>::format(
std::basic_string_view<CharT, Traits>{str}, ctx);
}
};
#endif

#undef ES_FMT_NS
#undef ES_WITH_STD_FORMAT

0 comments on commit a98ff88

Please sign in to comment.