| 53 | // It is a separate function rather than a part of vprint to simplify testing. |
| 54 | template <typename Char> |
| 55 | void write_buffer(std::basic_ostream<Char>& os, buffer<Char>& buf) { |
| 56 | const Char* buf_data = buf.data(); |
| 57 | using unsigned_streamsize = make_unsigned_t<std::streamsize>; |
| 58 | unsigned_streamsize size = buf.size(); |
| 59 | unsigned_streamsize max_size = to_unsigned(max_value<std::streamsize>()); |
| 60 | do { |
| 61 | unsigned_streamsize n = size <= max_size ? size : max_size; |
| 62 | os.write(buf_data, static_cast<std::streamsize>(n)); |
| 63 | buf_data += n; |
| 64 | size -= n; |
| 65 | } while (size != 0); |
| 66 | } |
| 67 | |
| 68 | template <typename T> struct streamed_view { |
| 69 | const T& value; |