ConstIterator 類

class QCborArray ::ConstIterator

The QCborArray::ConstIterator 類提供 STL 樣式 const 迭代器為 QCborArray . 更多...

此類 強烈可比較 .

此類 強烈可比較 with QCborArray::Iterator .

公共類型

iterator_category

公共函數

ConstIterator ()
ConstIterator (const QCborArray::ConstIterator & other )
QCborValueConstRef operator* () const
QCborArray::ConstIterator operator+ (qsizetype j ) const
QCborArray::ConstIterator & operator++ ()
QCborArray::ConstIterator operator++ (int)
QCborArray::ConstIterator & operator+= (qsizetype j )
qsizetype operator- (QCborArray::ConstIterator other ) const
QCborArray::ConstIterator operator- (qsizetype j ) const
QCborArray::ConstIterator & operator-- ()
QCborArray::ConstIterator operator-- (int)
QCborArray::ConstIterator & operator-= (qsizetype j )
const QCborValueConstRef * operator-> () const
QCborArray::ConstIterator & operator= (const QCborArray::ConstIterator & other )
QCborValueConstRef operator[] (qsizetype j ) const
bool operator!= (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )
bool operator< (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )
bool operator<= (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )
bool operator== (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )
bool operator> (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )
bool operator>= (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

詳細描述

QCborArray::ConstIterator allows you to iterate over a QCborArray . If you want to modify the QCborArray as you iterate over it, use QCborArray::Iterator instead. It is generally good practice to use QCborArray::ConstIterator , even on a non-const QCborArray , when you don't need to change the QCborArray through the iterator. Const iterators are slightly faster and improves code readability.

Iterators are initialized by using a QCborArray function like QCborArray::begin () 或 QCborArray::end (). Iteration is only possible after that.

Most QCborArray functions accept an integer index rather than an iterator. For that reason, iterators are rarely useful in connection with QCborArray . One place where STL-style iterators do make sense is as arguments to 一般算法 .

Multiple iterators can be used on the same array. However, be aware that any non-const function call performed on the QCborArray will render all existing iterators undefined.

另請參閱 QCborArray::Iterator .

成員類型文檔編製

ConstIterator:: iterator_category

同義詞 std::random_access_iterator_tag indicating this iterator is a random access iterator.

成員函數文檔編製

[constexpr noexcept] ConstIterator:: ConstIterator ()

Constructs an uninitialized iterator.

Functions like operator*() and operator++() should not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.

另請參閱 QCborArray::constBegin () 和 QCborArray::constEnd ().

[constexpr noexcept] ConstIterator:: ConstIterator (const QCborArray::ConstIterator & other )

構造副本為 other .

QCborValueConstRef ConstIterator:: operator* () const

返迴當前項。

QCborArray::ConstIterator ConstIterator:: operator+ ( qsizetype j ) const

Returns an iterator to the item at a position j steps forward from this iterator. If j is negative, the iterator goes backward.

另請參閱 operator- () 和 operator+= ().

QCborArray::ConstIterator &ConstIterator:: operator++ ()

前綴 ++ operator, ++it , advances the iterator to the next item in the array and returns this iterator.

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

另請參閱 operator-- ().

QCborArray::ConstIterator ConstIterator:: operator++ ( int )

這是重載函數。

The postfix ++ operator, it++ , advances the iterator to the next item in the array and returns an iterator to the previously current item.

QCborArray::ConstIterator &ConstIterator:: operator+= ( qsizetype j )

推進迭代器 j positions. If j is negative, the iterator goes backward. Returns a reference to this iterator.

另請參閱 operator-= () 和 operator+ ().

qsizetype ConstIterator:: operator- ( QCborArray::ConstIterator other ) const

Returns the offset of this iterator relative to other .

QCborArray::ConstIterator ConstIterator:: operator- ( qsizetype j ) const

Returns an iterator to the item at a position j steps backward from this iterator. If j is negative, the iterator goes forward.

另請參閱 operator+ () 和 operator-= ().

QCborArray::ConstIterator &ConstIterator:: operator-- ()

前綴 -- operator, --it , makes the preceding item current and returns this iterator.

Calling this function on QCborArray::begin () leads to undefined results.

另請參閱 operator++ ().

QCborArray::ConstIterator ConstIterator:: operator-- ( int )

這是重載函數。

The postfix -- operator, it-- , makes the preceding item current and returns an iterator to the previously current item.

QCborArray::ConstIterator &ConstIterator:: operator-= ( qsizetype j )

Makes the iterator go back by j positions. If j is negative, the iterator goes forward. Returns a reference to this iterator.

另請參閱 operator+= () 和 operator- ().

const QCborValueConstRef *ConstIterator:: operator-> () const

Returns a pointer to the current item.

QCborArray::ConstIterator &ConstIterator:: operator= (const QCborArray::ConstIterator & other )

Makes this iterator a copy of other and returns a reference to this iterator.

QCborValueConstRef ConstIterator:: operator[] ( qsizetype j ) const

Returns the item at a position j steps forward from the item pointed to by this iterator.

This function is provided to make QCborArray iterators behave like C++ pointers.

另請參閱 operator+ ().

相關非成員

[noexcept] bool operator!= (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

返迴 true if lhs points to a different entry in the array than rhs iterator; otherwise returns false .

另請參閱 operator== ().

[noexcept] bool operator< (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

返迴 true if the entry in the array pointed to by lhs iterator occurs before the entry pointed to by the rhs iterator.

[noexcept] bool operator<= (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

返迴 true if the entry in the array pointed to by lhs iterator occurs before or is the same entry as is pointed to by the rhs iterator.

[noexcept] bool operator== (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

返迴 true if lhs points to the same entry in the array as rhs iterator; otherwise returns false .

另請參閱 operator!= ().

[noexcept] bool operator> (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

返迴 true if the entry in the array pointed to by lhs iterator occurs after the entry pointed to by the rhs iterator.

[noexcept] bool operator>= (const QCborArray::ConstIterator & lhs , const QCborArray::ConstIterator & rhs )

返迴 true if the entry in the array pointed to by lhs iterator occurs after or is the same entry as is pointed to by the rhs iterator.