In questa pagina

QCborArray::ConstIterator Class

class QCborArray::ConstIterator

La classe ` QCborArray::ConstIterator ` fornisce un iteratore `const` in stile STL per ` QCborArray`. Altro...

Confronto tra QCborArray e ConstIterator

CategoriaTipi comparabili
forteQCborArray::ConstIterator
strongQCborArray::Iterator.

Tipi pubblici

Funzioni pubbliche

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)

Descrizione dettagliata

QCborArray::ConstIterator consente di iterare su un QCborArray. Se si desidera modificare l'QCborArray durante l'iterazione, utilizzare invece QCborArray::Iterator. In genere è buona norma utilizzare QCborArray::ConstIterator, anche su un QCborArray non costante, quando non è necessario modificare l'QCborArray tramite l'iteratore. Gli iteratori costanti sono leggermente più veloci e migliorano la leggibilità del codice.

Gli iteratori vengono inizializzati utilizzando una funzione QCborArray come QCborArray::begin() o QCborArray::end(). Solo dopo è possibile eseguire l’iterazione.

La maggior parte delle funzioni ` QCborArray ` accetta un indice intero anziché un iteratore. Per questo motivo, gli iteratori sono raramente utili in combinazione con ` QCborArray`. Un caso in cui gli iteratori in stile STL hanno senso è come argomenti di ` generic algorithms`.

È possibile utilizzare più iteratori sullo stesso array. Tuttavia, occorre tenere presente che qualsiasi chiamata a una funzione non const eseguita sull’ QCborArray renderà indefiniti tutti gli iteratori esistenti.

Vedi anche QCborArray::Iterator.

Documentazione sui tipi dei membri

ConstIterator::iterator_category

Sinonimo di std::random_access_iterator_tag che indica che questo iteratore è un iteratore ad accesso casuale.

Documentazione delle funzioni membro

[constexpr noexcept default] ConstIterator::ConstIterator()

Crea un iteratore non inizializzato.

Funzioni come operator*() e operator++() non devono essere chiamate su un iteratore non inizializzato. Utilizzare operator=() per assegnargli un valore prima di utilizzarlo.

Vedi anche QCborArray::constBegin() e QCborArray::constEnd().

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

Crea una copia di other.

QCborValueConstRef ConstIterator::operator*() const

Restituisce l'elemento corrente.

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

Restituisce un iteratore che punta all’elemento situato a una posizione pari a ` j ` passi in avanti rispetto a questo iteratore. Se ` j ` è negativo, l’iteratore si sposta all’indietro.

Vedi anche ` operator-()` e ` operator+=()`.

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

L'operatore con prefisso ++, ++it, sposta l'iteratore sull'elemento successivo dell'array e restituisce tale iteratore.

La chiamata a questa funzione su QCborArray::end() produce risultati indefiniti.

Vedi anche operator--().

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

L'operatore postfisso ++, it++, fa avanzare l'iteratore all'elemento successivo dell'array e restituisce un iteratore all'elemento su cui era posizionato l'iteratore in precedenza.

Si tratta di una funzione sovraccaricata.

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

Fai avanzare l'iteratore di j posizioni. Se j è negativo, l'iteratore va all'indietro. Restituisce un riferimento a questo iteratore.

Vedi anche operator-=() e operator+().

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

Restituisce l'offset di questo iteratore rispetto a other.

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

Restituisce un iteratore che punta all'elemento situato a una posizione pari a j, contando all'indietro rispetto a questo iteratore. Se j è negativo, l'iteratore procede in avanti.

Vedi anche ` operator+()` e ` operator-=()`.

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

L'operatore prefissato --, --it, imposta l'elemento precedente come corrente e restituisce questo iteratore.

La chiamata a questa funzione su ` QCborArray::begin()` produce risultati indefiniti.

Vedi anche operator++().

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

L'operatore postfisso --, it--, imposta l'elemento precedente come corrente e restituisce un iteratore all'elemento precedentemente corrente.

Si tratta di una funzione sovraccaricata.

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

Fa tornare indietro l'iteratore di j posizioni. Se j è negativo, l'iteratore va avanti. Restituisce un riferimento a questo iteratore.

Vedi anche ` operator+=()` e ` operator-()`.

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

Restituisce un puntatore all'elemento corrente.

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

Crea una copia dell'iteratore other e restituisce un riferimento a questo iteratore.

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

Restituisce l'elemento che si trova a una distanza di j passi in avanti rispetto all'elemento indicato da questo iteratore.

Questa funzione è stata fornita per far sì che gli iteratori QCborArray si comportino come i puntatori C++.

Vedi anche operator+().

Elementi non membri correlati

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

Restituisce true se lhs punta a una voce dell'array diversa da quella indicata dall'iteratore rhs; in caso contrario, restituisce false.

Vedi anche operator==().

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

Restituisce ` true ` se l'elemento dell'array a cui punta l'iteratore ` lhs ` si trova prima dell'elemento a cui punta l'iteratore ` rhs `.

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

Restituisce ` true ` se l'elemento dell'array a cui punta l'iteratore ` lhs ` precede o coincide con l'elemento a cui punta l'iteratore ` rhs `.

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

Restituisce true se lhs punta alla stessa voce dell'array dell'iteratore rhs; altrimenti restituisce false.

Vedi anche operator!=().

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

Restituisce ` true ` se l'elemento dell'array indicato dall'iteratore ` lhs ` si trova dopo l'elemento indicato dall'iteratore ` rhs `.

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

Restituisce ` true ` se l'elemento dell'array a cui punta l'iteratore ` lhs ` si trova dopo l'elemento a cui punta l'iteratore ` rhs ` oppure è lo stesso elemento.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.