I find my old code is invalid when using fmt 10.2.1.
'''
template<>
struct fmt::formatter<float > : formatter<string_view> {
auto format(float pointer, fmt::format_context& ctx) const {
if (pointer != nullptr) {
auto&& str = fmt::format("{}={}", (void)pointer, *pointer);
return formatterfmt::string_view::format(str, ctx); }
else {
return formatterfmt::string_view::format("nullptr", ctx);
}
}
};
int main() {
float a = 0.0;
fmt::print("{}\n",&a);
}
'''
error is "Formatting of non-void pointer is disallowed."
Compiler Explorer Code.cpp.zip