Explicitly cast ustring to string when passing to fmt

don't rely on implicit conversion which is no longer present in fmt
10.1.0

Fixes #2403
pull/2409/head
Jan Palus 2023-08-15 20:57:07 +02:00
parent e90c66a102
commit c8237437d2
No known key found for this signature in database
GPG Key ID: AF176E5122D88062
2 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ template <>
struct formatter<Glib::ustring> : formatter<std::string> { struct formatter<Glib::ustring> : formatter<std::string> {
template <typename FormatContext> template <typename FormatContext>
auto format(const Glib::ustring& value, FormatContext& ctx) { auto format(const Glib::ustring& value, FormatContext& ctx) {
return formatter<std::string>::format(value, ctx); return formatter<std::string>::format(static_cast<std::string>(value), ctx);
} }
}; };
} // namespace fmt } // namespace fmt

View File

@ -22,7 +22,7 @@ struct fmt::formatter<Glib::VariantBase> : formatter<std::string> {
template <typename FormatContext> template <typename FormatContext>
auto format(const Glib::VariantBase& value, FormatContext& ctx) { auto format(const Glib::VariantBase& value, FormatContext& ctx) {
if (is_printable(value)) { if (is_printable(value)) {
return formatter<std::string>::format(value.print(), ctx); return formatter<std::string>::format(static_cast<std::string>(value.print()), ctx);
} else { } else {
return formatter<std::string>::format(value.get_type_string(), ctx); return formatter<std::string>::format(value.get_type_string(), ctx);
} }