|
CXXIter 0.2
|
SourceTrait, that is used by CXXIter's standard source classes CXXIter::SrcMov, CXXIter::SrcRef and CXXIter::SrcCRef.
More...
#include <Traits.h>
Classes | |
| struct | ConstIteratorState |
| Type of the state structure stored in CXXIter's source classes, used to keep track of the iteration progress. More... | |
| struct | IteratorState |
| Type of the state structure stored in CXXIter's source classes, used to keep track of the iteration progress. More... | |
Public Types | |
| using | Item = typename TContainer::value_type |
Type of the item TContainer holds and provides for the iterator. More... | |
| using | ItemRef = typename TContainer::reference |
Type of the item TContainer holds and provides for the iterator, in referenced form. More... | |
| using | ItemConstRef = typename TContainer::const_reference |
Type of the item TContainer holds and provides for the iterator, in const referenced form. More... | |
Static Public Member Functions | |
| static constexpr SizeHint | sizeHint (const TContainer &container) |
Report a size hint for a source on the given container. More... | |
| static constexpr IteratorState | initIterator (TContainer &container) |
Return an initial IteratorState instance for iteration on the given container. More... | |
| static constexpr ConstIteratorState | initIterator (const TContainer &container) |
Return an initial IteratorState instance for iteration on the given container. More... | |
| static constexpr bool | hasNext (TContainer &container, IteratorState &iter) |
Checks whether there is a next item in the iteration with the given iter state on the given container. More... | |
| static constexpr bool | hasNext (const TContainer &container, ConstIteratorState &iter) |
Checks whether there is a next item in the iteration with the given iter state on the given container. More... | |
| static constexpr ItemRef | next (TContainer &container, IteratorState &iter) |
Return the next item in the iteration with the given iter state on the given container. More... | |
| static constexpr ItemConstRef | next (const TContainer &container, ConstIteratorState &iter) |
Return the next item in the iteration with the given iter state on the given container. More... | |
| static constexpr ItemRef | peekNext (TContainer &container, IteratorState &iter) |
Return the next item in the iteration with the given iter state on the given container, without advancing. More... | |
| static constexpr ItemConstRef | peekNext (const TContainer &container, ConstIteratorState &iter) |
Return the next item in the iteration with the given iter state on the given container, without advancing. More... | |
| static constexpr size_t | skipN (const TContainer &container, IteratorState &iter, size_t n) |
Skip the next n elements from the container. More... | |
| static constexpr size_t | skipN (const TContainer &container, ConstIteratorState &iter, size_t n) |
Skip the next n elements from the container. More... | |
Double-Ended iterator functionality (optional) | |
| static constexpr ItemRef | nextBack (TContainer &container, IteratorState &iter) |
Return the next item from the back of the iteration with the given iter state on the given container. More... | |
| static constexpr ItemConstRef | nextBack (const TContainer &container, ConstIteratorState &iter) |
Return the next item from the back of the iteration with the given iter state on the given container. More... | |
| static constexpr size_t | skipNBack (const TContainer &container, IteratorState &iter, size_t n) |
| Skip the next n elements from the back of this iterator. More... | |
| static constexpr size_t | skipNBack (const TContainer &container, ConstIteratorState &iter, size_t n) |
| Skip the next n elements from the back of this iterator. More... | |
SourceTrait, that is used by CXXIter's standard source classes CXXIter::SrcMov, CXXIter::SrcRef and CXXIter::SrcCRef.
If you want to add support for your own containers to these sources, and thus to CXXIter::from() calls, create a template specialization of CXXIter::SourceTrait, for your container class.
This is the default implementation supporting all STL containers.
| using CXXIter::trait::Source< TContainer >::Item = typename TContainer::value_type |
| using CXXIter::trait::Source< TContainer >::ItemConstRef = typename TContainer::const_reference |
| using CXXIter::trait::Source< TContainer >::ItemRef = typename TContainer::reference |
|
inlinestaticconstexpr |
Checks whether there is a next item in the iteration with the given iter state on the given container.
This is used for CXXIter::SrcCRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
true when there is another item available, false otherwise.
|
inlinestaticconstexpr |
Checks whether there is a next item in the iteration with the given iter state on the given container.
This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
true when there is another item available, false otherwise.
|
inlinestaticconstexpr |
Return an initial IteratorState instance for iteration on the given container.
This is stored within CXXIter's source classes, to hold the iteration's state. This is used for CXXIter::SrcCRef
| container | Container on which the source runs. |
ConstIteratorState
|
inlinestaticconstexpr |
Return an initial IteratorState instance for iteration on the given container.
This is stored within CXXIter's source classes, to hold the iteration's state. This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the source runs. |
IteratorState
|
inlinestaticconstexpr |
Return the next item in the iteration with the given iter state on the given container.
This is used for CXXIter::SrcCRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
|
inlinestaticconstexpr |
Return the next item in the iteration with the given iter state on the given container.
This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
|
inlinestaticconstexpr |
Return the next item from the back of the iteration with the given iter state on the given container.
This is used for CXXIter::SrcCRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
|
inlinestaticconstexpr |
Return the next item from the back of the iteration with the given iter state on the given container.
This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
|
inlinestaticconstexpr |
Return the next item in the iteration with the given iter state on the given container, without advancing.
This is used for CXXIter::SrcCRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
hasNext() returns false is undefined behavior!
|
inlinestaticconstexpr |
Return the next item in the iteration with the given iter state on the given container, without advancing.
This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
hasNext() returns false is undefined behavior!
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
Skip the next n elements from the container.
This is used for CXXIter::SrcCRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
| n | The amount of elements to skip. |
n elements remaining). Definition at line 256 of file Traits.h.
|
inlinestaticconstexpr |
Skip the next n elements from the container.
This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
| n | The amount of elements to skip. |
n elements remaining). Definition at line 243 of file Traits.h.
|
inlinestaticconstexpr |
Skip the next n elements from the back of this iterator.
This is used for CXXIter::SrcCRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
| n | The amount of elements to skip. |
n elements remaining). Definition at line 306 of file Traits.h.
|
inlinestaticconstexpr |
Skip the next n elements from the back of this iterator.
This is used for CXXIter::SrcMov and CXXIter::SrcRef
| container | Container on which the current iteration is running. |
| iter | The current iteration's state structure. |
| n | The amount of elements to skip. |
n elements remaining). Definition at line 293 of file Traits.h.