Skip to content

Commit fadae4d

Browse files
committed
Update csv_writer.hpp
1 parent 75883d8 commit fadae4d

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

include/internal/csv_writer.hpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,17 @@ namespace internals {
275275
}
276276

277277
/** Configure whether each write operation flushes the underlying stream. */
278-
DelimWriter& set_auto_flush(bool value) noexcept {
278+
DelimWriter& set_auto_flush(bool value) & noexcept {
279279
this->auto_flush_ = value;
280280
return *this;
281281
}
282282

283+
/** Configure whether each write operation flushes the underlying stream. */
284+
DelimWriter&& set_auto_flush(bool value) && noexcept {
285+
this->auto_flush_ = value;
286+
return std::move(*this);
287+
}
288+
283289
/** Return whether each write operation flushes the underlying stream. */
284290
bool get_auto_flush() const noexcept {
285291
return this->auto_flush_;
@@ -583,8 +589,7 @@ namespace internals {
583589
return;
584590
}
585591

586-
if (batch_buffer_.size() >= batch_flush_threshold_)
587-
flush_batch();
592+
flush_batch_if_needed();
588593
}
589594

590595
void flush_batch() {
@@ -594,6 +599,11 @@ namespace internals {
594599
batch_buffer_.clear();
595600
}
596601

602+
void flush_batch_if_needed() {
603+
if (batch_buffer_.size() >= batch_flush_threshold_)
604+
flush_batch();
605+
}
606+
597607
/**
598608
* An owned output stream, if the writer owns it.
599609
* May be null if the writer does not own its output stream, i.e.

0 commit comments

Comments
 (0)