Queue
1.0.0
A C++17 Library of various `queue` containers
|
iterator for the circular_queue class. More...
#include <circular_queue.h>
Public Types | |
using | iterator_category = std::random_access_iterator_tag |
using | value_type = T |
using | difference_type = ptrdiff_t |
using | pointer = T * |
using | reference = T & |
Public Member Functions | |
iterator (const circular_queue *const buffer, pointer start, bool parity) noexcept | |
Constructor. More... | |
iterator (const circular_queue *const buffer, queue_pointer pointer) noexcept | |
iterator (const iterator &other)=default | |
iterator & | operator= (const iterator &other)=default |
iterator (iterator &&other) noexcept | |
iterator & | operator= (iterator &&other) noexcept |
~iterator () noexcept=default | |
destructor. Complexity: Constant. Exception Safety: No-throw guarantee: This function never throws exceptions. | |
reference | operator* () const |
Dereference operator. More... | |
pointer | operator& () const |
Dereference operator. More... | |
pointer | operator-> () const |
Dereference operator. More... | |
reference | operator[] (difference_type n) const |
Dereference iterator with offset. More... | |
bool | operator== (const iterator &rhs) const noexcept |
equality operator More... | |
bool | operator!= (const iterator &rhs) const |
inequality operator Complexity: Constant. Iterator Validity: No changes. Data Races: The container is accessed. Exception Safety: No-throw guarantee: This function never throws exceptions. More... | |
iterator & | operator++ () noexcept |
Increment iterator position (prefix) More... | |
iterator | operator++ (int) |
Increment iterator position (postfix) More... | |
iterator & | operator+= (difference_type n) noexcept |
Advance iterator. More... | |
iterator | operator+ (difference_type n) const noexcept |
Addition operator. More... | |
iterator & | operator-- () noexcept |
Decrease iterator position (prefix) More... | |
iterator | operator-- (int) |
Decrease iterator position (postfix) More... | |
iterator & | operator-= (difference_type n) noexcept |
Retrocede iterator. More... | |
iterator | operator- (difference_type n) const |
subtraction operator More... | |
difference_type | operator- (const iterator &other) const |
subtraction operator More... | |
bool | operator< (const iterator &rhs) const noexcept |
less-than operator More... | |
bool | operator<= (const iterator &rhs) const |
less-than-or-equal operator More... | |
bool | operator> (const iterator &rhs) const |
greater-than operator More... | |
bool | operator>= (const iterator &rhs) const |
greater-than-or-equal operator More... | |
operator const_iterator () const | |
Allow implicit conversion from iterator to const_iterator as required by STL. | |
Protected Attributes | |
const circular_queue * | m_buffer = nullptr |
queue_pointer | m_pointer |
Iterator position. | |
Friends | |
class | circular_queue |
iterator for the circular_queue class.
|
inlinenoexcept |
Constructor.
Creates an initialized iterator. Complexity: Constant.
Iterator Validity: N/A.
Data Races: N/A.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | buffer | pointer to the underlying container. |
[in] | start | pointer to the iterator's starting offset |
|
inline |
inequality operator Complexity: Constant.
Iterator Validity: No changes.
Data Races: The container is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | rhs | right-hand-side of the equation. |
|
inline |
Dereference operator.
Returns a pointer to the element pointed to by the iterator. Complexity: Constant.
Iterator Validity: Unchanged.
Data Races: The object is accessed.
Exception Safety: Undefined if the iterator is not valid.
|
inline |
Dereference operator.
Returns a reference to the element pointed to by the iterator. Complexity: Constant.
Iterator Validity: No changes.
Data Races: The object is accessed.
Exception Safety: Undefined if the iterator is not valid.
|
inlinenoexcept |
Addition operator.
Returns an iterator pointing to the element located n positions away from the element the iterator currently points to.
Complexity: Constant.
Iterator Validity: Undefined behavior if the element n positions away is out of bounds.
Data Races: The object is accessed but NOT modified.
Exception Safety: Strong guarantee: if the constructor throws an exception, there are no side effects.
[in] | n | number of elements to offset. |
|
inlinenoexcept |
Increment iterator position (prefix)
Advances the iterator by 1 position. Complexity: Constant.
Iterator Validity: Valid IFF the iterator is incrementable.
Data Races: The object is modified.
Exception Safety: No-throw guarantee: This function never throws exceptions.
|
inline |
Increment iterator position (postfix)
Advances the iterator by 1 position. Complexity: Constant.
Iterator Validity: Valid IFF the iterator is incrementable.
Data Races: The object is modified.
Exception Safety: Strong guarantee: if the function throws an exception, there are no side effects.
|
inlinenoexcept |
Advance iterator.
Advances the iterator by n element positions.
Complexity: Constant.
Iterator Validity: Results in undefined behavior if the element at position n does not exist.
Data Races: The object is modified.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[] | n |
|
inline |
subtraction operator
Returns the distance between two iterators. Complexity: Constant.
Iterator Validity: Undefined behavior if the iterator is not decrementable, otherwise no changes.
Data Races: the object is accessed but NOT modified.
Exception Safety: Strong guarantee: if the constructor throws an exception, there are no side effects.
[in] | other | iterator to determine distance from. |
|
inline |
subtraction operator
Returns an iterator whose position is n elements before the current position Complexity: Constant.
Iterator Validity: Undefined behavior if the iterator is not decrementable, otherwise no changes.
Data Races: the object is accessed but NOT modified.
Exception Safety: Strong guarantee: if the constructor throws an exception, there are no side effects.
[in] | nNumber | of elements to offset. Member type difference_type is an alias of the base container's own difference type. |
|
inlinenoexcept |
Decrease iterator position (prefix)
Decreases the iterator by one position.
Complexity: Constant.
Iterator Validity: Undefined behavior if the iterator is not decrementable, otherwise no changes.
Data Races: The object is modified.
Exception Safety: No-throw guarantee: This function never throws exceptions.
|
inline |
Decrease iterator position (postfix)
Decreases the iterator by one position.
Complexity: Constant.
Iterator Validity: Undefined behavior if the iterator is not decrementable, otherwise no changes.
Data Races: The object is accessed but NOT modified.
Exception Safety: Strong guarantee: if the constructor throws an exception, there are no side effects.
|
inlinenoexcept |
Retrocede iterator.
Decreases the iterator by n element positions. Complexity: Constant.
Iterator Validity: Undefined behavior if the iterator is not decrementable, otherwise no changes.
Data Races: The object is modified.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | n | Number of elements to offset. Member type difference_type is an alias of the base container's own difference type. |
|
inline |
Dereference operator.
Returns a pointer to the element pointed to by the iterator. Complexity: Constant.
Iterator Validity: Unchanged.
Data Races: The object is accessed.
Exception Safety: Undefined if the iterator is not valid.
|
inlinenoexcept |
less-than operator
Performs the appropriate comparison. Complexity: Constant.
Iterator Validity: No changes.
Data Races: The object is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | rhs | iterator for the right-hand side of the comparison. |
|
inline |
less-than-or-equal operator
Performs the appropriate comparison. Complexity: Constant.
Iterator Validity: No changes.
Data Races: The object is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | rhs | iterator for the right-hand side of the comparison. |
|
inlinenoexcept |
equality operator
Two iterators are equal if they point to the same object and have the same parity value (i.e. one isn't wrapped around the buffer from the other).
Complexity: Constant.
Iterator Validity: No changes.
Data Races: The container is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | rhs | right-hand-side of the equation. |
|
inline |
greater-than operator
Performs the appropriate comparison. Complexity: Constant.
Iterator Validity: No changes.
Data Races: The object is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | rhs | iterator for the right-hand side of the comparison. |
|
inline |
greater-than-or-equal operator
Performs the appropriate comparison. Complexity: Constant.
Iterator Validity: No changes.
Data Races: The object is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
[in] | rhs | iterator for the right-hand side of the comparison. |
|
inline |
Dereference iterator with offset.
Accesses the element located n positions away from the element currently pointed to by the iterator. If such an element does not exist, it causes undefined behavior. Complexity: Constant.
Iterator Validity: Unchanged.
Data Races: The object is accessed. Depending on the return type, the value returned may be used to access or modify elements.
Exception Safety: Undefined behavior if n is out of range.
[in] | n | Number of elements to offset. Member type difference_type is an alias of the base container's own difference type. |