Iterator 类

class QCborArray ::Iterator

The QCborArray::Iterator 类提供 STL 样式非常量迭代器为 QCborArray . 更多...

此类 强烈可比较 .

此类 强烈可比较 with QCborArray::ConstIterator .

公共类型

iterator_category

公共函数

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

详细描述

QCborArray::Iterator allows you to iterate over a QCborArray and to modify the array item associated with the iterator. If you want to iterate over a const QCborArray ,使用 QCborArray::ConstIterator instead. It is generally a good practice to use QCborArray::ConstIterator on a non-const QCborArray as well, unless you need to change the QCborArray through the iterator. Const iterators are slightly faster and improve code readability.

Iterators are initialized by using a QCborArray function like QCborArray::begin (), QCborArray::end (),或 QCborArray::insert (). 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::ConstIterator .

成员类型文档编制

Iterator:: iterator_category

同义词 std::random_access_iterator_tag indicating this iterator is a random access iterator.

成员函数文档编制

[constexpr noexcept] Iterator:: Iterator ()

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::begin () 和 QCborArray::end ().

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

制作副本为 other .

QCborValueRef Iterator:: operator* () const

Returns a modifiable reference to the current item.

You can change the value of an item by using operator*() on the left side of an assignment.

The return value is of type QCborValueRef, a helper class for QCborArray and QCborMap . When you get an object of type QCborValueRef, you can use it as if it were a reference to a QCborValue . If you assign to it, the assignment will apply to the element in the QCborArray or QCborMap from which you got the reference.

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

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

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

QCborArray::Iterator &Iterator:: operator++ ()

The prefix ++ 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::Iterator Iterator:: 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::Iterator &Iterator:: operator+= ( qsizetype j )

Advances the iterator by j positions. If j is negative, the iterator goes backward. Returns a reference to this iterator.

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

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

Returns the offset of this iterator relative to other .

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

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

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

QCborArray::Iterator &Iterator:: operator-- ()

The prefix -- operator, --it , makes the preceding item current and returns this iterator.

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

另请参阅 operator++ ().

QCborArray::Iterator Iterator:: operator-- ( int )

这是重载函数。

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

QCborArray::Iterator &Iterator:: 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 *Iterator:: operator-> () const

Returns a pointer to a modifiable reference to the current item.

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

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

QCborValueRef Iterator:: operator[] ( qsizetype j ) const

Returns a modifiable reference to 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.

The return value is of type QCborValueRef, a helper class for QCborArray and QCborMap . When you get an object of type QCborValueRef, you can use it as if it were a reference to a QCborValue . If you assign to it, the assignment will apply to the element in the QCborArray or QCborMap from which you got the reference.

另请参阅 operator+ ().

相关非成员

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

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

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

另请参阅 operator!= ().

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

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

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

另请参阅 operator== ().

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

[noexcept] bool operator< (const QCborArray::Iterator & lhs , const QCborArray::Iterator & 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::Iterator & lhs , const QCborArray::ConstIterator & rhs )

[noexcept] bool operator<= (const QCborArray::Iterator & lhs , const QCborArray::Iterator & 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::Iterator & lhs , const QCborArray::ConstIterator & rhs )

[noexcept] bool operator> (const QCborArray::Iterator & lhs , const QCborArray::Iterator & 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::Iterator & lhs , const QCborArray::ConstIterator & rhs )

[noexcept] bool operator>= (const QCborArray::Iterator & lhs , const QCborArray::Iterator & 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.