constant iterator for the circular_queue class.
More...
#include <circular_queue.h>
|
using | iterator_category = std::random_access_iterator_tag |
|
using | value_type = const T |
|
using | difference_type = ptrdiff_t |
|
using | pointer = const T * |
|
using | reference = const T & |
|
template<class T, class Alloc = std::allocator<T>>
class circular_queue< T, Alloc >::const_iterator
constant iterator for the circular_queue class.
◆ const_iterator()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | buffer | pointer to the underlying container. |
[in] | start | pointer to the iterators starting offset |
◆ operator!=()
template<class T , class Alloc = std::allocator<T>>
inequality operator Complexity: Constant.
Iterator Validity: No changes.
Data Races: The container is accessed.
Exception Safety: No-throw guarantee: This function never throws exceptions.
- Parameters
-
[in] | rhs | right-hand-side of the equation. |
- Returns
- true if both iterators point to different objects.
◆ operator&()
template<class T , class Alloc = std::allocator<T>>
pointer circular_queue< T, Alloc >::const_iterator::operator& |
( |
| ) |
const |
|
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.
- Returns
- A pointer to the element pointed by the iterator.
◆ operator*()
template<class T , class Alloc = std::allocator<T>>
reference circular_queue< T, Alloc >::const_iterator::operator* |
( |
| ) |
const |
|
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.
- Returns
- A reference to the element pointed by the iterator.
◆ operator+()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | n | number of elements to offset. |
- Returns
- An iterator pointing to the element n positions away.
◆ operator++() [1/2]
template<class T , class Alloc = std::allocator<T>>
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.
- Returns
- A reference to the incremented iterator.
◆ operator++() [2/2]
template<class T , class Alloc = std::allocator<T>>
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.
- Returns
- A copy of the iterator before it was incremented.
◆ operator+=()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
- Returns
- circular_queueIterator&
◆ operator-() [1/2]
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | other | iterator to determine distance from.
|
- Returns
- number of elements between the two iterators.
◆ operator-() [2/2]
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | nNumber | of elements to offset. Member type difference_type is an alias of the base container's own difference type.
|
- Returns
- An iterator decremented n positions from the current iterator position.
◆ operator--() [1/2]
template<class T , class Alloc = std::allocator<T>>
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.
- Returns
- A reference to an iterator pointing to the post-decrement iterator.
◆ operator--() [2/2]
template<class T , class Alloc = std::allocator<T>>
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.
- Returns
- A iterator pointing to the pre-decremented element.
◆ operator-=()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | n | Number of elements to offset. Member type difference_type is an alias of the base container's own difference type.
|
- Returns
- the iterator itself, decremented by n positions.
◆ operator->()
template<class T , class Alloc = std::allocator<T>>
pointer circular_queue< T, Alloc >::const_iterator::operator-> |
( |
| ) |
const |
|
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.
- Returns
- A pointer to the element pointed by the iterator.
◆ operator<()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | rhs | iterator for the right-hand side of the comparison. |
- Returns
- true if this iterator is less than rhs.
◆ operator<=()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | rhs | iterator for the right-hand side of the comparison. |
- Returns
- true if this iterator is less than or equal to rhs.
◆ operator==()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | rhs | right-hand-side of the equation. |
- Returns
- true if both iterators point to the same object.
◆ operator>()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | rhs | iterator for the right-hand side of the comparison. |
- Returns
- true if this iterator is greater than rhs.
◆ operator>=()
template<class T , class Alloc = std::allocator<T>>
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.
- Parameters
-
[in] | rhs | iterator for the right-hand side of the comparison. |
- Returns
- true if this iterator is greater than or equal to rhs.
◆ operator[]()
template<class T , class Alloc = std::allocator<T>>
reference circular_queue< T, Alloc >::const_iterator::operator[] |
( |
difference_type |
n | ) |
const |
|
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.
- Parameters
-
[in] | n | Number of elements to offset. Member type difference_type is an alias of the base container's own difference type. |
- Returns
- The element n positions away from the element currently pointed by the iterator.
The documentation for this class was generated from the following file: