このページでは

ConstReference Class

template <typename Referred> class QVariant::ConstReference

QVariant::ConstReferenceQVariant への const リファレンスとして動作します

このクラスは Qt 6.11 で導入されました。

パブリック関数

ConstReference(Referred &&referred)
ConstReference(const Referred &referred)
QVariant operator QVariant() const

詳細な説明

ジェネリック・イテレータは、各ステップで実際にQVariant をインスタンス化しないので、operator*() からその参照を返すことはできません。QVariant::ConstReference は、QVariant への実際の参照と同じ機能を提供しますが、テンプレート・パラメータとして与えられた参照先の値を返します。このテンプレートは QMetaSequence::ConstIterator, QMetaSequence::Iterator, QMetaAssociation::ConstIterator, QMetaAssociation::Iterator に対して実装されています。

メンバ関数のドキュメント

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

referred からQVariant::ConstReference を作成する。

注: この関数は、std::is_nothrow_move_constructible_v<Referred>true の場合は noexcept となる。

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

referred からQVariant::ConstReference を作成する。

注: この関数は、std::is_nothrow_copy_constructible_v<Referred>true の場合は noexcept となる。

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

QVariant への参照をデリファレンスします。 このメソッドは、それぞれのReferred型に特化する必要があります。QMetaSequence::ConstIterator, QMetaSequence::Iterator, QMetaAssociation::ConstIterator, QMetaAssociation::Iterator のためにあらかじめ定義されています。

注意: Referred::canNoexceptConvertToQVarianttrue の場合、この関数は noexcept となります。

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