|
VectorPro
High-performance, header-only dynamic array with configurable growth policy, custom allocator support, and optional modification-event notifications.
|
A raw-pointer-backed contiguous random-access iterator. More...
#include <Iterator.h>
Public Types | |
| using | iterator_concept = std::contiguous_iterator_tag |
| using | iterator_category = std::random_access_iterator_tag |
| using | value_type = std::remove_cv_t< T > |
| using | element_type = T |
| using | difference_type = std::ptrdiff_t |
| using | pointer = T * |
| using | reference = T & |
Public Member Functions | |
| constexpr | Iterator () noexcept=default |
| Constructs a null (singular) iterator. | |
| constexpr | Iterator (pointer ptr) noexcept |
Constructs an iterator pointing to ptr. | |
| template<typename U > requires std::is_same_v<U, std::remove_cv_t<T>> | |
| constexpr | Iterator (const Iterator< U > &other) noexcept |
| Converting constructor from a non-const iterator to a const iterator. | |
| constexpr reference | operator* () const noexcept |
| Dereferences the iterator. | |
| constexpr pointer | operator-> () const noexcept |
| Returns the underlying pointer. | |
| constexpr reference | operator[] (difference_type n) const noexcept |
Accesses the element n positions away. | |
| constexpr Iterator & | operator++ () noexcept |
| Pre-increments the iterator to point to the next element. | |
| constexpr Iterator | operator++ (int) noexcept |
| Post-increments the iterator to point to the next element. | |
| constexpr Iterator & | operator-- () noexcept |
| Pre-decrements the iterator to point to the previous element. | |
| constexpr Iterator | operator-- (int) noexcept |
| Post-decrements the iterator to point to the previous element. | |
| constexpr Iterator & | operator+= (difference_type n) noexcept |
Advances the iterator by n positions. | |
| constexpr Iterator & | operator-= (difference_type n) noexcept |
Moves the iterator back by n positions. | |
Friends | |
| constexpr Iterator | operator+ (Iterator i, difference_type n) noexcept |
Returns an iterator advanced by n positions. | |
| constexpr Iterator | operator+ (difference_type n, Iterator i) noexcept |
Returns an iterator advanced by n positions. | |
| constexpr Iterator | operator- (Iterator i, difference_type n) noexcept |
Returns an iterator moved back by n positions. | |
| constexpr difference_type | operator- (Iterator a, Iterator b) noexcept |
| Computes the distance between two iterators. | |
| constexpr bool | operator== (const Iterator &a, const Iterator &b) noexcept |
| Compares two iterators for equality. | |
| constexpr auto | operator<=> (const Iterator &a, const Iterator &b) noexcept |
| Three-way compares two iterators by position. | |
A raw-pointer-backed contiguous random-access iterator.
| T | Element type pointed to. May be const-qualified for a const iterator. |
Satisfies std::contiguous_iterator. Used as VectorPro::Vector's iterator and const_iterator (with T and const T respectively).
| using VectorPro::Iterator< T >::difference_type = std::ptrdiff_t |
| using VectorPro::Iterator< T >::element_type = T |
| using VectorPro::Iterator< T >::iterator_category = std::random_access_iterator_tag |
| using VectorPro::Iterator< T >::iterator_concept = std::contiguous_iterator_tag |
| using VectorPro::Iterator< T >::pointer = T* |
| using VectorPro::Iterator< T >::reference = T& |
| using VectorPro::Iterator< T >::value_type = std::remove_cv_t<T> |
|
constexprdefaultnoexcept |
Constructs a null (singular) iterator.
|
inlineexplicitconstexprnoexcept |
Constructs an iterator pointing to ptr.
| ptr | Pointer to the element the iterator should reference. |
|
inlineconstexprnoexcept |
Converting constructor from a non-const iterator to a const iterator.
| U | Source element type, must be std::remove_cv_t<T>. |
| other | Iterator to convert from. |
Enables implicit iterator -> const_iterator conversion.
|
inlineconstexprnoexcept |
Dereferences the iterator.
|
inlineconstexprnoexcept |
Pre-increments the iterator to point to the next element.
*this.
|
inlineconstexprnoexcept |
Post-increments the iterator to point to the next element.
it++ = x-style misuse. That conflicts with C++20's std::incrementable concept (required by std::contiguous_iterator, which this type satisfies), which mandates { i++ } -> std::same_as<I> – an exact, non-const Iterator return type. The concept requirement wins here, so this diagnostic is intentionally suppressed.
|
inlineconstexprnoexcept |
Advances the iterator by n positions.
| n | Number of positions to advance (may be negative). |
*this.
|
inlineconstexprnoexcept |
Pre-decrements the iterator to point to the previous element.
*this.
|
inlineconstexprnoexcept |
Post-decrements the iterator to point to the previous element.
operator++(int) note above – the same std::incrementable/concept conflict applies here, so cert-dcl21-cpp is intentionally suppressed rather than adding const.
|
inlineconstexprnoexcept |
Moves the iterator back by n positions.
| n | Number of positions to move back (may be negative). |
*this.
|
inlineconstexprnoexcept |
Returns the underlying pointer.
|
inlineconstexprnoexcept |
Accesses the element n positions away.
| n | Offset from the current position. |
|
friend |
Returns an iterator advanced by n positions.
| i | Base iterator. |
| n | Number of positions to advance. |
i by n.
|
friend |
Returns an iterator advanced by n positions.
| i | Base iterator. |
| n | Number of positions to advance. |
i by n.
|
friend |
Computes the distance between two iterators.
| a | First iterator. |
| b | Second iterator. |
b and a (a - b).
|
friend |
Returns an iterator moved back by n positions.
| i | Base iterator. |
| n | Number of positions to move back. |
i by -n.
|
friend |
Three-way compares two iterators by position.
| a | First iterator. |
| b | Second iterator. |
a and b.
|
friend |
Compares two iterators for equality.
| a | First iterator. |
| b | Second iterator. |
true if both point to the same element.