mirror of
https://github.com/fmtlib/fmt.git
synced 2026-07-30 16:26:27 +08:00
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().
This commit is contained in:
parent
7b4ef1c814
commit
21d6c98b02
@ -70,6 +70,8 @@ template <typename T> struct streamed_view {
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
FMT_BEGIN_EXPORT
|
||||
|
||||
// Formats an object of type T that has an overloaded ostream operator<<.
|
||||
template <typename Char>
|
||||
struct basic_ostream_formatter : formatter<basic_string_view<Char>, 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 <typename... T>
|
||||
template <typename... T>
|
||||
void print(std::ostream& os, format_string<T...> fmt, T&&... args) {
|
||||
fmt::vargs<T...> 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<T...> fmt, T&&... args) {
|
||||
detail::write_buffer(os, buffer);
|
||||
}
|
||||
|
||||
FMT_EXPORT template <typename... T>
|
||||
template <typename... T>
|
||||
void println(std::ostream& os, format_string<T...> fmt, T&&... args) {
|
||||
fmt::print(os, FMT_STRING("{}\n"),
|
||||
fmt::format(fmt, std::forward<T>(args)...));
|
||||
}
|
||||
|
||||
FMT_END_EXPORT
|
||||
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_OSTREAM_H_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user