15 size_t drain_front_batches(
16 std::deque<std::vector<T>>& batches,
22 const size_t drain_count = size < max_items ? size : max_items;
23 size_t remaining = drain_count;
25 out.reserve(out.size() + drain_count);
27 while (remaining > 0) {
28 auto& batch = batches.front();
29 const size_t available = batch.size() - front_index;
30 const size_t take = available < remaining ? available : remaining;
31 const auto first_offset =
static_cast<typename std::vector<T>::difference_type
>(front_index);
32 const auto take_offset =
static_cast<typename std::vector<T>::difference_type
>(take);
33 auto first = batch.begin() + first_offset;
34 auto last = first + take_offset;
38 std::make_move_iterator(first),
39 std::make_move_iterator(last)
46 while (!batches.empty() && front_index >= batches.front().size()) {
The all encompassing namespace.