xentara-utils v2.0.4
The Xentara Utility Library
|
An iterator that can be used to count the length of an output sequence. More...
#include <xentara/utils/core/CountingIterator.hpp>
Classes | |
class | Sink |
a dummy object used for assigning values More... | |
Public Types | |
using | value_type = DummyValue |
The element type. | |
using | difference_type = std::make_signed_t< Count > |
The type used for distances. | |
using | reference = Sink |
A reference to an element. | |
using | pointer = void |
A pointer to an element. | |
using | iterator_category = std::output_iterator_tag |
The iterator category, for use in pre-C++20 code. | |
using | iterator_concept = std::output_iterator_tag |
The iterator concept, for use in C++20 code. | |
Public Member Functions | |
constexpr | CountingIterator () noexcept=default |
Default constructor. | |
CountingIterator (std::reference_wrapper< Count > count) noexcept | |
Constructor. | |
constexpr auto | operator++ () noexcept -> CountingIterator & |
Pre-increment operator. | |
constexpr auto | operator++ (int) noexcept -> CountingIterator |
Post-increment operator. | |
constexpr auto | operator-- () noexcept -> CountingIterator & |
Pre-decrement operator. | |
constexpr auto | operator-- (int) noexcept -> CountingIterator |
Post-decrement operator. | |
constexpr auto | operator+= (difference_type offset) noexcept -> CountingIterator & |
Addition assignment operator. | |
constexpr auto | operator-= (difference_type offset) noexcept -> CountingIterator & |
Subtraction assignment operator. | |
constexpr auto | operator* () const noexcept -> reference |
Indirection operator. | |
constexpr auto | operator[] (difference_type) const noexcept -> reference |
Subscript operator. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename DummyValue , tools::Integral Count> | |
auto | countingIterator (std::reference_wrapper< Count > count) -> CountingIterator< DummyValue, Count > |
Creates a counting iterator. | |
An iterator that can be used to count the length of an output sequence.
This iterator simply keeps track of how many times it is incremented.
DummyValue | The type of the values written. This is only used to define the embedded types, the class itself does not use the type. |
Count | The type to use for the counter |
using xentara::utils::core::CountingIterator< DummyValue, Count >::difference_type = std::make_signed_t<Count> |
The type used for distances.
using xentara::utils::core::CountingIterator< DummyValue, Count >::iterator_category = std::output_iterator_tag |
The iterator category, for use in pre-C++20 code.
using xentara::utils::core::CountingIterator< DummyValue, Count >::iterator_concept = std::output_iterator_tag |
The iterator concept, for use in C++20 code.
using xentara::utils::core::CountingIterator< DummyValue, Count >::pointer = void |
A pointer to an element.
using xentara::utils::core::CountingIterator< DummyValue, Count >::reference = Sink |
A reference to an element.
using xentara::utils::core::CountingIterator< DummyValue, Count >::value_type = DummyValue |
The element type.
|
constexprdefaultnoexcept |
Default constructor.
This constructor creates a dummy object that doesn't actually count anything.
|
noexcept |
Constructor.
count | The counter to update |
|
constexprnoexcept |
Indirection operator.
|
constexprnoexcept |
Pre-increment operator.
Increments the count by one.
|
constexprnoexcept |
Post-increment operator.
Increments the count by one.
|
constexprnoexcept |
Addition assignment operator.
Adds a certain offset to the count.
|
constexprnoexcept |
Pre-decrement operator.
Decrements the count by one.
|
constexprnoexcept |
Post-decrement operator.
Decrements the count by one.
|
constexprnoexcept |
Subtraction assignment operator.
Subtracts a certain offset from the count.
|
constexprnoexcept |
Subscript operator.
|
related |
Creates a counting iterator.
count | The counter to update. If you want to pass a regular variable to update, you should wrap the variable in std::ref() to enable template type deduction. |