29 this->records_ = other.records_;
30 this->_is_empty = other._is_empty;
31 this->_is_waitable = other._is_waitable;
35 : _is_empty(source.empty()),
38 bool empty()
const noexcept {
39 return this->_is_empty;
42 void push_back(T&& item) {
43 this->records_.push_back(std::move(item));
44 this->_is_empty =
false;
47 void append_rows(std::vector<T>&& rows) {
52 this->records_.insert(
54 std::make_move_iterator(rows.begin()),
55 std::make_move_iterator(rows.end())
57 this->_is_empty =
false;
60 T pop_front()
noexcept {
61 T item = std::move(this->records_.front());
62 this->records_.pop_front();
64 if (this->records_.empty()) {
65 this->_is_empty =
true;
73 const size_t drain_count = this->records_.size() < max_items ? this->records_.size() : max_items;
74 out.reserve(out.size() + drain_count);
76 for (
size_t i = 0; i < drain_count; ++i) {
77 out.push_back(std::move(this->records_.front()));
78 this->records_.pop_front();
81 if (this->records_.empty()) {
82 this->_is_empty =
true;
88 bool is_waitable() const noexcept {
89 return this->_is_waitable;
96 size_t size() const noexcept {
97 return this->records_.size();
101 this->_is_waitable =
true;
105 this->_is_waitable =
false;
109 bool _is_empty =
true;
110 bool _is_waitable =
false;
111 std::deque<T> records_;