IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QTaggedIterator Class

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits.

This class was introduced in Qt 6.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QTaggedIterator Class

  • Header: QTaggedIterator

  • Since: Qt 6.0

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Core)

    target_link_libraries(mytarget PRIVATE Qt6::Core)

  • qmake: QT += core

  • Inherits:

Detailed Description

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.

Member Function Documentation

 

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

Returns true if other points to a different item than this iterator; otherwise returns false.

See Also

See also operator==()

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

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

See Also

See also 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.

See Also

See also operator--()

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

This is an overloaded function.

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 items.

See Also

See also 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.

See Also

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

Returns the distance between this iterator and j.

See Also

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.

See Also

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

This is an overloaded function.

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.

See Also

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

Makes the iterator go back by j items.

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

See Also

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

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

See Also

See also operator!=()

Related Non-Members

 

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

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

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+