/** * Move all items on this queue into the given queue while * retaining item order. The items will be inserted at the back of * the target queue. * * @param q the target queue **/ void moveInto(ArrayQueue<T> &q) { while (_used > 0) { q.emplace(std::move(access(0))); pop(); } }
/** * Copy all items on this queue into the given queue while * retaining item order. The items will be inserted at the back of * the target queue. * * @param q the target queue **/ void copyInto(ArrayQueue<T> &q) const { for (uint32_t i = 0; i < _used; ++i) { q.emplace(peek(i)); } }