forked from fmtlib/fmt
Avoid overhead on sensible platforms
This commit is contained in:
@@ -93,8 +93,9 @@ inline bool write(std::wfilebuf&, fmt::basic_string_view<wchar_t>) {
|
|||||||
// It is a separate function rather than a part of vprint to simplify testing.
|
// It is a separate function rather than a part of vprint to simplify testing.
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
void write_buffer(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
void write_buffer(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
||||||
if (auto filebuf = dynamic_cast<std::basic_filebuf<Char>*>(os.rdbuf())) {
|
if (FMT_MSC_VER) {
|
||||||
if (write(*filebuf, {buf.data(), buf.size()})) return;
|
auto filebuf = dynamic_cast<std::basic_filebuf<Char>*>(os.rdbuf());
|
||||||
|
if (filebuf && write(*filebuf, {buf.data(), buf.size()})) return;
|
||||||
}
|
}
|
||||||
const Char* buf_data = buf.data();
|
const Char* buf_data = buf.data();
|
||||||
using unsigned_streamsize = std::make_unsigned<std::streamsize>::type;
|
using unsigned_streamsize = std::make_unsigned<std::streamsize>::type;
|
||||||
|
Reference in New Issue
Block a user