Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTaggedIterator< Iterator, IteratorCategory > Class Template Reference

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits. More...

#include <qiterable.h>

+ Inheritance diagram for QTaggedIterator< Iterator, IteratorCategory >:
+ Collaboration diagram for QTaggedIterator< Iterator, IteratorCategory >:

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.
 
QTaggedIteratoroperator++ ()
 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.
 
QTaggedIteratoroperator-- ()
 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.
 
QTaggedIteratoroperator+= (qsizetype j)
 Advances the iterator by j items.
 
QTaggedIteratoroperator-= (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.
 

Detailed Description

template<class Iterator, typename IteratorCategory>
class QTaggedIterator< Iterator, IteratorCategory >

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits.

Since
6.0 \inmodule QtCore

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.

Member Typedef Documentation

◆ iterator_category

template<class Iterator , typename IteratorCategory >
using QTaggedIterator< Iterator, IteratorCategory >::iterator_category = IteratorCategory

Definition at line 70 of file qiterable.h.

Constructor & Destructor Documentation

◆ QTaggedIterator()

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator ( Iterator && it)
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.

Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator+(), QTaggedIterator< Iterator, IteratorCategory >::operator++(), QTaggedIterator< Iterator, IteratorCategory >::operator-(), and QTaggedIterator< Iterator, IteratorCategory >::operator--().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ operator!=()

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > bool QTaggedIterator< Iterator, IteratorCategory >::operator!= ( const QTaggedIterator< Iterator, IteratorCategory > & o) const
inline

Returns true if other points to a different item than this iterator; otherwise returns false.

See also
operator==()

Definition at line 104 of file qiterable.h.

References o.

◆ operator+()

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > QTaggedIterator< Iterator, IteratorCategory >::operator+ ( qsizetype j) const
inline

Returns an iterator to the item at j positions forward from this iterator.

See also
operator-(), operator+=()

Definition at line 111 of file qiterable.h.

References QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator(), and j.

+ Here is the call graph for this function:

◆ operator++() [1/2]

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > & QTaggedIterator< Iterator, IteratorCategory >::operator++ ( )
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.

See also
operator--()

Definition at line 105 of file qiterable.h.

◆ operator++() [2/2]

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > QTaggedIterator< Iterator, IteratorCategory >::operator++ ( int x)
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 106 of file qiterable.h.

References QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator().

+ Here is the call graph for this function:

◆ operator+=()

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > & QTaggedIterator< Iterator, IteratorCategory >::operator+= ( qsizetype j)
inline

Advances the iterator by j items.

See also
operator-=(), operator+()

Definition at line 109 of file qiterable.h.

References j.

◆ operator-() [1/2]

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > qsizetype QTaggedIterator< Iterator, IteratorCategory >::operator- ( const QTaggedIterator< Iterator, IteratorCategory > & j) const
inline

Returns the distance between this iterator and j.

See also
operator+(), operator-=(), QIterable::canReverseIterate()

Definition at line 113 of file qiterable.h.

References j.

◆ operator-() [2/2]

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > QTaggedIterator< Iterator, IteratorCategory >::operator- ( qsizetype j) const
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.

See also
operator+(), operator-=(), QIterable::canReverseIterate()

Definition at line 112 of file qiterable.h.

References QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator(), and j.

Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator<(), and QTaggedIterator< Iterator, IteratorCategory >::operator>().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator--() [1/2]

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > & 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.

See also
operator++(), QIterable::canReverseIterate()

Definition at line 107 of file qiterable.h.

◆ operator--() [2/2]

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > QTaggedIterator< Iterator, IteratorCategory >::operator-- ( int x)
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.

See also
QIterable::canReverseIterate()

Definition at line 108 of file qiterable.h.

References QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator().

+ Here is the call graph for this function:

◆ operator-=()

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > & QTaggedIterator< Iterator, IteratorCategory >::operator-= ( qsizetype j)
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.

See also
operator+=(), operator-(), QIterable::canReverseIterate()

Definition at line 110 of file qiterable.h.

References j.

◆ operator<()

template<class Iterator , typename IteratorCategory >
bool QTaggedIterator< Iterator, IteratorCategory >::operator< ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 115 of file qiterable.h.

References j, and QTaggedIterator< Iterator, IteratorCategory >::operator-().

Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator>=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<=()

template<class Iterator , typename IteratorCategory >
bool QTaggedIterator< Iterator, IteratorCategory >::operator<= ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 118 of file qiterable.h.

References j, and QTaggedIterator< Iterator, IteratorCategory >::operator>().

+ Here is the call graph for this function:

◆ operator==()

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > bool QTaggedIterator< Iterator, IteratorCategory >::operator== ( const QTaggedIterator< Iterator, IteratorCategory > & o) const
inline

Returns true if other points to the same item as this iterator; otherwise returns false.

See also
operator!=()

Definition at line 103 of file qiterable.h.

References o.

◆ operator>()

template<class Iterator , typename IteratorCategory >
bool QTaggedIterator< Iterator, IteratorCategory >::operator> ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 117 of file qiterable.h.

References j, and QTaggedIterator< Iterator, IteratorCategory >::operator-().

Referenced by QTaggedIterator< Iterator, IteratorCategory >::operator<=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator>=()

template<class Iterator , typename IteratorCategory >
bool QTaggedIterator< Iterator, IteratorCategory >::operator>= ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 116 of file qiterable.h.

References j, and QTaggedIterator< Iterator, IteratorCategory >::operator<().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator+

template<class Iterator , typename IteratorCategory >
template< class Iterator, typename IteratorCategory > QTaggedIterator< Iterator, IteratorCategory > QTaggedIterator< Iterator, IteratorCategory >::operator+ ( qsizetype j,
const QTaggedIterator< Iterator, IteratorCategory > & k )
friend

Returns an iterator to the item at j positions forward from iterator k.

Definition at line 120 of file qiterable.h.


The documentation for this class was generated from the following files: