QTaggedIterator 类

template <typename Iterator, typename IteratorCategory> class QTaggedIterator

QTaggedIterator 是包裹迭代器并暴露标准迭代器特质的模板类。 更多...

头: #include <QTaggedIterator>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.0

公共函数

QTaggedIterator (Iterator && it )
bool operator!= (const QTaggedIterator<Iterator, IteratorCategory> & other ) const
QTaggedIterator<Iterator, IteratorCategory> operator+ (qsizetype j ) const
QTaggedIterator<Iterator, IteratorCategory> & operator++ ()
QTaggedIterator<Iterator, IteratorCategory> operator++ (int x )
QTaggedIterator<Iterator, IteratorCategory> & operator+= (qsizetype j )
QTaggedIterator<Iterator, IteratorCategory> operator- (qsizetype j ) const
qsizetype operator- (const QTaggedIterator<Iterator, IteratorCategory> & j ) const
QTaggedIterator<Iterator, IteratorCategory> & operator-- ()
QTaggedIterator<Iterator, IteratorCategory> operator-- (int x )
QTaggedIterator<Iterator, IteratorCategory> & operator-= (qsizetype j )
bool operator== (const QTaggedIterator<Iterator, IteratorCategory> & other ) const
QTaggedIterator<Iterator, IteratorCategory> operator+ (qsizetype j , const QTaggedIterator<Iterator, IteratorCategory> & k )

详细描述

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 .

成员函数文档编制

QTaggedIterator:: QTaggedIterator ( Iterator && it )

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.

bool QTaggedIterator:: operator!= (const QTaggedIterator < Iterator , IteratorCategory > & other ) const

返回 true if other 指向与此迭代器不同的项;否则返回 false .

另请参阅 operator== ().

QTaggedIterator < Iterator , IteratorCategory > QTaggedIterator:: operator+ ( qsizetype j ) const

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

另请参阅 operator- () 和 operator+= ().

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

Calling this function on QSequentialIterable::end() leads to undefined results.

另请参阅 operator-- ().

QTaggedIterator < Iterator , IteratorCategory > QTaggedIterator:: operator++ ( int x )

这是重载函数。

The postfix ++ operator ( it++ ) advances the iterator to the next item in the container and returns an iterator to the previously current item.

QTaggedIterator < Iterator , IteratorCategory > &QTaggedIterator:: operator+= ( qsizetype j )

Advances the iterator by j 项。

另请参阅 operator-= () 和 operator+ ().

QTaggedIterator < Iterator , IteratorCategory > QTaggedIterator:: operator- ( qsizetype j ) const

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.

另请参阅 operator+ (), operator-= (),和 QIterable::canReverseIterate ().

qsizetype QTaggedIterator:: operator- (const QTaggedIterator < Iterator , IteratorCategory > & j ) const

Returns the distance between this iterator and j .

另请参阅 operator+ (), operator-= (),和 QIterable::canReverseIterate ().

QTaggedIterator < Iterator , IteratorCategory > &QTaggedIterator:: operator-- ()

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.

另请参阅 operator++ () 和 QIterable::canReverseIterate ().

QTaggedIterator < Iterator , IteratorCategory > QTaggedIterator:: operator-- ( int x )

这是重载函数。

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.

另请参阅 QIterable::canReverseIterate ().

QTaggedIterator < Iterator , IteratorCategory > &QTaggedIterator:: operator-= ( qsizetype j )

Makes the iterator go back by j 项。

If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.

另请参阅 operator+= (), operator- (),和 QIterable::canReverseIterate ().

bool QTaggedIterator:: operator== (const QTaggedIterator < Iterator , IteratorCategory > & other ) const

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

另请参阅 operator!= ().

相关非成员

QTaggedIterator < Iterator , IteratorCategory > operator+ ( qsizetype j , const QTaggedIterator < Iterator , IteratorCategory > & k )

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