Fix moving ostream while holding data

This commit is contained in:
Junliang HU 2021-03-29 21:01:07 +08:00
parent 291b0075bb
commit b77d2a8c85

View File

@ -396,8 +396,10 @@ class ostream final : private detail::buffer<char> {
ostream(ostream&& other)
: detail::buffer<char>(other.data(), other.size(), other.capacity()),
file_(std::move(other.file_)) {
other.clear();
other.set(nullptr, 0);
}
~ostream() {
flush();
delete[] data();