QIterator 结构

template <typename Container> struct QIterator

QIterator 是允许迭代容器的模板类,在 QVariant . 更多...

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

公共函数

  QIterator (QIterable<Container> * iterable , void * iterator )
bool operator!= (const QIterator<Container> & other ) const
QIterator<Container> operator+ (qsizetype j ) const
QIterator<Container> & operator++ ()
QIterator<Container> operator++ (int)
QIterator<Container> & operator+= (qsizetype j )
QIterator<Container> operator- (qsizetype j ) const
qsizetype operator- (const QIterator<Container> & j ) const
QIterator<Container> & operator-- ()
QIterator<Container> operator-- (int)
QIterator<Container> & operator-= (qsizetype j )
bool operator== (const QIterator<Container> & other ) const
QIterator<Container> operator+ (qsizetype j , const QIterator<Container> & k )

详细描述

A QIterator can only be created by a QIterable instance, and can be used in a way similar to other stl-style iterators. Generally, QIterator should not be used directly, but through its derived classes provided by QSequentialIterable and QAssociativeIterable .

另请参阅 QIterable .

成员函数文档编制

QIterator:: QIterator ( QIterable < Container > * iterable , void * iterator )

Creates an iterator from an iterable and a pointer to a native iterator .

bool QIterator:: operator!= (const QIterator < Container > & other ) const

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

另请参阅 operator== ().

QIterator < Container > QIterator:: operator+ ( qsizetype j ) const

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

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

QIterator < Container > &QIterator:: 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-- ().

QIterator < Container > QIterator:: operator++ ( int )

这是重载函数。

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

QIterator < Container > &QIterator:: operator+= ( qsizetype j )

Advances the iterator by j 项。

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

QIterator < Container > QIterator:: 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 QIterator:: operator- (const QIterator < Container > & j ) const

Returns the distance between the two iterators.

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

QIterator < Container > &QIterator:: 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 ().

QIterator < Container > QIterator:: operator-- ( int )

这是重载函数。

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 ().

QIterator < Container > &QIterator:: 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 QIterator:: operator== (const QIterator < Container > & other ) const

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

另请参阅 operator!= ().

相关非成员

QIterator < Container > operator+ ( qsizetype j , const QIterator < Container > & k )

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