![]() |
Qt 6.x
The Qt SDK
|
QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits. More...
#include <qiterable.h>
Public Types | |
using | iterator_category = IteratorCategory |
Public Member Functions | |
QTaggedIterator (Iterator &&it) | |
Constructs a QTaggedIterator from an iterator or QConstIterator it. | |
bool | operator== (const QTaggedIterator &o) const |
Returns true if other points to the same item as this iterator; otherwise returns false . | |
bool | operator!= (const QTaggedIterator &o) const |
Returns true if other points to a different item than this iterator; otherwise returns false . | |
QTaggedIterator & | operator++ () |
The prefix {++} operator ( {++it}) advances the iterator to the next item in the container and returns an iterator to the new current item. | |
QTaggedIterator | operator++ (int x) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {++} operator ( {it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item. | |
QTaggedIterator & | operator-- () |
The prefix {–} operator ( {–it}) makes the preceding item current and returns an iterator to the new current item. | |
QTaggedIterator | operator-- (int x) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {–} operator ( {it–}) makes the preceding item current and returns an iterator to the previously current item. | |
QTaggedIterator & | operator+= (qsizetype j) |
Advances the iterator by j items. | |
QTaggedIterator & | operator-= (qsizetype j) |
Makes the iterator go back by j items. | |
QTaggedIterator | operator+ (qsizetype j) const |
Returns an iterator to the item at j positions forward from this iterator. | |
QTaggedIterator | operator- (qsizetype j) const |
Returns an iterator to the item at j positions backward from this iterator. | |
qsizetype | operator- (const QTaggedIterator &j) const |
Returns the distance between this iterator and j. | |
bool | operator< (const QTaggedIterator &j) |
bool | operator>= (const QTaggedIterator &j) |
bool | operator> (const QTaggedIterator &j) |
bool | operator<= (const QTaggedIterator &j) |
Friends | |
QTaggedIterator | operator+ (qsizetype j, const QTaggedIterator &k) |
Returns an iterator to the item at j positions forward from iterator k. | |
QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits.
In order to use an iterator any of the standard algorithms, its iterator traits need to be known. As QSequentialIterable can work with many different kinds of containers, we cannot declare the traits in the iterator classes themselves. A QTaggedIterator gives you a way to explicitly declare a trait for a concrete instance of an iterator or QConstIterator.
Definition at line 67 of file qiterable.h.
using QTaggedIterator< Iterator, IteratorCategory >::iterator_category = IteratorCategory |
Definition at line 70 of file qiterable.h.
|
inline |
Constructs a QTaggedIterator from an iterator or QConstIterator it.
Checks whether the IteratorCategory passed as template argument matches the run time capabilities of it; if there's no match, it is refused.
Definition at line 71 of file qiterable.h.
References QMetaContainer::hasBidirectionalIterator(), QMetaContainer::hasForwardIterator(), QMetaContainer::hasInputIterator(), QMetaContainer::hasRandomAccessIterator(), and qFatal.
|
inline |
Returns true
if other points to a different item than this iterator; otherwise returns false
.
Definition at line 100 of file qiterable.h.
References o.
|
inline |
Returns an iterator to the item at j positions forward from this iterator.
Definition at line 107 of file qiterable.h.
References j.
|
inline |
The prefix {++} operator (
{++it}) advances the iterator to the next item in the container and returns an iterator to the new current item.
Calling this function on QSequentialIterable::end() leads to undefined results.
Definition at line 101 of file qiterable.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {++} operator (
{it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item.
Definition at line 102 of file qiterable.h.
|
inline |
Advances the iterator by j items.
Definition at line 105 of file qiterable.h.
References j.
|
inline |
Returns the distance between this iterator and j.
Definition at line 109 of file qiterable.h.
References j.
|
inline |
Returns an iterator to the item at j positions backward from this iterator.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
Definition at line 108 of file qiterable.h.
References j.
Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator<(), and QTaggedIterator< Iterator, IteratorCategory >::operator>().
|
inline |
The prefix {–} operator (
{–it}) makes the preceding item current and returns an iterator to the new current item.
Calling this function on QSequentialIterable::begin() leads to undefined results.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
Definition at line 103 of file qiterable.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {–} operator (
{it–}) makes the preceding item current and returns an iterator to the previously current item.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
Definition at line 104 of file qiterable.h.
|
inline |
Makes the iterator go back by j items.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
Definition at line 106 of file qiterable.h.
References j.
|
inline |
Definition at line 111 of file qiterable.h.
References j, and QTaggedIterator< Iterator, IteratorCategory >::operator-().
Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator>=().
|
inline |
Definition at line 114 of file qiterable.h.
References j, and QTaggedIterator< Iterator, IteratorCategory >::operator>().
|
inline |
Returns true
if other points to the same item as this iterator; otherwise returns false
.
Definition at line 99 of file qiterable.h.
References o.
|
inline |
Definition at line 113 of file qiterable.h.
References j, and QTaggedIterator< Iterator, IteratorCategory >::operator-().
Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator<=().
|
inline |
Definition at line 112 of file qiterable.h.
References j, and QTaggedIterator< Iterator, IteratorCategory >::operator<().
|
friend |
Returns an iterator to the item at j positions forward from iterator k.
Definition at line 116 of file qiterable.h.