QVariant::ConstReference Class

template <typename Indirect> class QVariant::ConstReference

The QVariant::ConstReference acts as a const reference to a QVariant. More...

This class was introduced in Qt 6.11.

Public Functions

ConstReference(Indirect &&referred)
ConstReference(QVariant::Reference<Indirect> &&nonConst)
ConstReference(const Indirect &referred)
ConstReference(const QVariant::Reference<Indirect> &nonConst)
ConstReference(const QVariant::ConstReference<Indirect> &)
ConstReference(QVariant::ConstReference<Indirect> &&)
~ConstReference()
operator QVariant() const
QVariant::ConstReference<Indirect> &operator=(QVariant::ConstReference<Indirect> &&value)
QVariant::ConstReference<Indirect> &operator=(const QVariant::ConstReference<Indirect> &value)

Detailed Description

As the generic iterators don't actually instantiate a QVariant on each step, they cannot return a reference to one from operator*(). QVariant::ConstReference<Indirect> provides the same functionality as an actual reference to a QVariant would, but is backed by a referred-to value of type Indirect. The template is implemented for QMetaSequence::ConstIterator, QMetaSequence::Iterator, QMetaAssociation::ConstIterator, and QMetaAssociation::Iterator.

Member Function Documentation

[explicit noexcept(...)] ConstReference::ConstReference(Indirect &&referred)

Creates a QVariant::ConstReference from a referred.

Note: This function is noexcept when std::is_nothrow_move_constructible_v<Indirect> is true.

[implicit] ConstReference::ConstReference(QVariant::Reference<Indirect> &&nonConst)

Creates a QVariant::ConstReference from a nonConst Reference.

[explicit noexcept(...)] ConstReference::ConstReference(const Indirect &referred)

Creates a QVariant::ConstReference from a referred.

Note: This function is noexcept when std::is_nothrow_copy_constructible_v<Indirect> is true.

[noexcept(...)] ConstReference::ConstReference(const QVariant::Reference<Indirect> &nonConst)

Creates a QVariant::ConstReference from a nonConst Reference.

Note: This function is noexcept when std::is_nothrow_copy_constructible_v<Indirect> is true.

[noexcept(...) default] ConstReference::ConstReference(const QVariant::ConstReference<Indirect> &)

Copy-constructs an instance of ConstReference.

Note: This function is noexcept when std::is_nothrow_copy_constructible_v<Indirect> is true.

[delete] ConstReference::ConstReference(QVariant::ConstReference<Indirect> &&)

Move-constructs an instance of ConstReference. This function is deleted.

[default] ConstReference::~ConstReference()

Destroys the instance of ConstReference.

[noexcept(...)] ConstReference::operator QVariant() const

Dereferences the reference to a QVariant. This method needs to be specialized for each Indirect type. It is pre-defined for QMetaSequence::ConstIterator, QMetaSequence::Iterator, QMetaAssociation::ConstIterator, and QMetaAssociation::Iterator.

Note: This function is noexcept when Indirect::CanNoexceptConvertToQVariant is true.

[delete] QVariant::ConstReference<Indirect> &ConstReference::operator=(QVariant::ConstReference<Indirect> &&value)

Move-assigns value to this ConstReference instance. This function is deleted.

[delete] QVariant::ConstReference<Indirect> &ConstReference::operator=(const QVariant::ConstReference<Indirect> &value)

Copy-assigns value to this ConstReference instance. This function is deleted.