diff --git a/include/fmt/os.h b/include/fmt/os.h index 3171dad3..c86c2153 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -343,16 +343,10 @@ class file { // Returns the memory page size. long getpagesize(); -class direct_buffered_file; - -template -void print(direct_buffered_file& f, const S& format_str, const Args&... args); - // A buffered file with a direct buffer access and no synchronization. class direct_buffered_file : private detail::buffer { private: file file_; - char buffer_[BUFSIZ]; void flush() { @@ -361,13 +355,10 @@ class direct_buffered_file : private detail::buffer { clear(); } - int free_capacity() const { return static_cast(BUFSIZ - size()); } - - protected: void grow(size_t) final; public: - direct_buffered_file(const char* path, int oflag) + direct_buffered_file(cstring_view path, int oflag) : buffer(buffer_, 0, BUFSIZ), file_(path, oflag) {} ~direct_buffered_file() { flush(); } @@ -379,10 +370,13 @@ class direct_buffered_file : private detail::buffer { template friend void print(direct_buffered_file& f, const S& format_str, - const Args&... args) { - fmt::format_to(detail::buffer_appender(f), format_str, args...); - } + const Args&... args); }; + +template +void print(direct_buffered_file& f, const S& format_str, const Args&... args) { + format_to(detail::buffer_appender(f), format_str, args...); +} #endif // FMT_USE_FCNTL #ifdef FMT_LOCALE