CppCommon  1.0.4.1
C++ Common Library
containers_queue.cpp

Intrusive queue container example

#include <iostream>
struct MyQueueNode : public CppCommon::Queue<MyQueueNode>::Node
{
int value;
explicit MyQueueNode(int v) : value(v) {}
};
int main(int argc, char** argv)
{
MyQueueNode item1(123);
MyQueueNode item2(456);
MyQueueNode item3(789);
queue.push(item1);
queue.push(item2);
queue.push(item3);
while (queue)
std::cout << "queue.pop() = " << queue.pop()->value << std::endl;
return 0;
}
Intrusive queue container.
Definition: queue.h:104
T * pop() noexcept
Pop the item from the front of the queue.
Definition: queue.inl:68
void push(T &item) noexcept
Push a new item into the back of the queue.
Definition: queue.inl:56
Intrusive queue container definition.