Closed BenFrantzDale closed 2 months ago
Are you sure that is_std_string_like<QString>::value
returns true? AFAICS QString
doesn't have find_first_of
(https://doc.qt.io/qt-6/qstring.html) which is used as a std::string[_view]
detection heuristic.
You seem to be correct, at least in trunk
it works: https://godbolt.org/z/ME1j55zMz
My use case is migrating a Qt codebase to more-standard C++, so I have a mix of
QString
(UTF-16) andstd::string
. I'd like to specialize a formatter that lets me formatQString
to produce UTF-8, so I can juststd::string s = fmt::format("foo: {}", someString);
in generic code and have it work ifsomeString
isQString
orstd::string
orstd::string_view
.AFAICT, fmt's formatter selection is pretty aggressive: if
is_std_string_like<T>::value
it insists on going with a default formatter, even if I want to specialize it for formatting to a different character type: https://godbolt.org/z/T3fhKrEdeIs there any way around this?