From 21d6c98b021020c9e15b8e4d0e63061e87e2358b Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Mon, 20 Jul 2026 19:08:27 +0300 Subject: [PATCH] Export ostream formatters and streamed() from the module Make basic_ostream_formatter, ostream_formatter and streamed() accessible to module users via FMT_BEGIN_EXPORT/FMT_BEGIN_EXPORT. Drop now unneeded FMT_EXPORT for print() and println(). --- include/fmt/ostream.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index da9c65e0..34b8e96f 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -70,6 +70,8 @@ template struct streamed_view { }; } // namespace detail +FMT_BEGIN_EXPORT + // Formats an object of type T that has an overloaded ostream operator<<. template struct basic_ostream_formatter : formatter, Char> { @@ -147,7 +149,7 @@ inline void vprint(std::ostream& os, string_view fmt, format_args args) { * * fmt::print(cerr, "Don't {}!", "panic"); */ -FMT_EXPORT template +template void print(std::ostream& os, format_string fmt, T&&... args) { fmt::vargs vargs = {{args...}}; if FMT_CONSTEXPR20 (detail::use_utf8) return vprint(os, fmt.str, vargs); @@ -156,12 +158,14 @@ void print(std::ostream& os, format_string fmt, T&&... args) { detail::write_buffer(os, buffer); } -FMT_EXPORT template +template void println(std::ostream& os, format_string fmt, T&&... args) { fmt::print(os, FMT_STRING("{}\n"), fmt::format(fmt, std::forward(args)...)); } +FMT_END_EXPORT + FMT_END_NAMESPACE #endif // FMT_OSTREAM_H_