54 q.
for_each([] (
unsigned i) { cout <<
" " << i; });
57 cout <<
"rear de 0: " << q.
rear() << endl
58 <<
"rear de 1: " << q.
rear(1) << endl
59 <<
"rear de 2: " << q.
rear(2)<< endl
60 <<
"rear de 3: " << q.
rear(3)<< endl
61 <<
"la cola deberia ser: " << endl;
63 cout << q.
get() <<
" ";
Very simple queue implemented with a contiguous array.
constexpr bool is_empty() const noexcept
Return true if the queue is empty.
T get() noexcept
Remove the oldest item of the queue.
T & putn(const size_t n) noexcept
Put n cells to the queue in constant time.
T & rear(const size_t i=0) noexcept
Return the i-th youngest item.
void for_each(Operation &operation) const
Traverse all the container and performs an operation on each element.
Circular queue implementations backed by arrays.