ConstReference Class
template <typename Referred> class QVariant::ConstReferenceQVariant::ConstReference 充当QVariant 的常量引用 ... 更多...
该类在 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 的引用。此方法需要为每种引用类型专门设计。它为 QMetaSequence::ConstIterator、QMetaSequence::Iterator、QMetaAssociation::ConstIterator 和 QMetaAssociation::Iterator 预先定义。
注意: 当Referred::canNoexceptConvertToQVariant 为true 时,此函数为 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.