Closed tocic closed 5 months ago
Those are specializations for different string types. I will investigate why your example doesn't work with std::string
formatter but in the meantime you can use a formatter for fmt::string_view
which works: https://godbolt.org/z/eo4Y7d7nP.
Documented the list of formatter specializations provided by fmt/base.h
(which will superseed fmt/core.h
): https://github.com/fmtlib/fmt/commit/f30f1fd5141dd22afdcd32fafaa1f58f10bae8fc. In general it should be sufficient to use fmt::string_view
but if you want a formatter of std::string
for some reason you should include fmt/format.h
.
It's not clear for me from the docs if this test project is correct. What are the differences between
fmt::formatter<const char*>
,fmt::formatter<std::string_view>
,fmt::formatter<std::string>
? Can I include onlyfmt/core.h
in headers (as in the second example here)? I thought the CE in fmt 10.2.1 (not on trunk) was related to this issue, but now I'm not sure.