9 #ifndef CPPCOMMON_CONTAINERS_QUEUE_H
10 #define CPPCOMMON_CONTAINERS_QUEUE_H
21 class QueueConstIterator;
102 template <
typename T>
125 Queue() noexcept : _size(0), _front(
nullptr), _back(
nullptr) {}
126 template <
class InputIterator>
127 Queue(InputIterator first, InputIterator last) noexcept;
136 explicit operator
bool() const noexcept {
return !
empty(); }
139 bool empty() const noexcept {
return _front ==
nullptr; }
142 size_t size() const noexcept {
return _size; }
145 T*
front() noexcept {
return _front; }
146 const T*
front() const noexcept {
return _front; }
148 T*
back() noexcept {
return _back; }
149 const T*
back() const noexcept {
return _back; }
164 void push(T& item) noexcept;
176 void clear() noexcept;
180 template <typename U>
193 template <typename T>
219 {
return it1._node == it2._node; }
221 {
return it1._node != it2._node; }
230 explicit operator
bool() const noexcept {
return _node !=
nullptr; }
234 template <
typename U>
245 template <
typename T>
267 { _node = it._node;
return *
this; }
272 {
return it1._node == it2._node; }
274 {
return it1._node != it2._node; }
283 explicit operator
bool() const noexcept {
return _node !=
nullptr; }
287 template <
typename U>
Intrusive queue constant iterator.
QueueConstIterator & operator=(QueueConstIterator &&it) noexcept=default
QueueConstIterator(QueueConstIterator &&it) noexcept=default
QueueConstIterator(const QueueConstIterator &it) noexcept=default
std::forward_iterator_tag iterator_category
const value_type * const_pointer
QueueConstIterator & operator=(const QueueConstIterator &it) noexcept=default
friend void swap(QueueConstIterator< U > &it1, QueueConstIterator< U > &it2) noexcept
friend bool operator==(const QueueConstIterator &it1, const QueueConstIterator &it2) noexcept
friend bool operator!=(const QueueConstIterator &it1, const QueueConstIterator &it2) noexcept
QueueConstIterator() noexcept
ptrdiff_t difference_type
QueueConstIterator(const QueueIterator< T > &it) noexcept
~QueueConstIterator() noexcept=default
const value_type & const_reference
QueueConstIterator(const T *node) noexcept
Intrusive queue container.
const_iterator cbegin() const noexcept
T * pop() noexcept
Pop the item from the front of the queue.
void reverse() noexcept
Reverse the queue.
Queue(Queue &&) noexcept=default
const_iterator cend() const noexcept
T * front() noexcept
Get the front queue item.
bool empty() const noexcept
Is the queue empty?
iterator end() noexcept
Get the end queue iterator.
QueueIterator< T > iterator
void push(T &item) noexcept
Push a new item into the back of the queue.
QueueConstIterator< T > const_iterator
const value_type * const_pointer
void swap(Queue &queue) noexcept
Swap two instances.
ptrdiff_t difference_type
void clear() noexcept
Clear the queue.
T * back() noexcept
Get the back queue item.
size_t size() const noexcept
Get the queue size.
const T * front() const noexcept
iterator begin() noexcept
Get the begin queue iterator.
const value_type & const_reference
Queue(const Queue &) noexcept=default
const T * back() const noexcept
Intrusive queue iterator.
const value_type & const_reference
QueueIterator(QueueIterator &&it) noexcept=default
const value_type * const_pointer
~QueueIterator() noexcept=default
QueueIterator(T *node) noexcept
friend void swap(QueueIterator< U > &it1, QueueIterator< U > &it2) noexcept
QueueIterator(const QueueIterator &it) noexcept=default
ptrdiff_t difference_type
std::forward_iterator_tag iterator_category
friend bool operator!=(const QueueIterator &it1, const QueueIterator &it2) noexcept
C++ Common project definitions.
Intrusive queue container inline implementation.
T * next
Pointer to the next queue node.