本页内容

QVariant::ConstPointer Class

template <typename Indirect> class QVariant::ConstPointer

QVariant::ConstPointer 是一个模板类,用于模拟指向QVariant 的常量指针。更多内容...

该类在 Qt 6.11 中引入。

公共函数

ConstPointer(Indirect &&pointed)
ConstPointer(const Indirect &pointed)
QVariant::ConstReference<Indirect> operator*() const

详细说明

QVariant::ConstPointer<Indirect> 封装了一个类型为Indirect 的被指值,并通过其 operator*() 返回指向该值的QVariant::ConstReference 。这使其适合作为实际指针的替代品。我们无法从泛型迭代器中返回实际指针,因为迭代器本身并不持有实际的QVariant 。

成员函数文档

[explicit noexcept(...)] ConstPointer::ConstPointer(Indirect &&pointed)

根据值pointed to 构建一个QVariant::ConstPointer 。

注意: 当std::is_nothrow_move_constructible_v<Indirect> 为true 时,该 函数为 noexcept。

[explicit noexcept(...)] ConstPointer::ConstPointer(const Indirect &pointed)

根据值pointed to 构造一个QVariant::ConstPointer 。

注意: 当std::is_nothrow_copy_constructible_v<Indirect> 为true 时,此 函数为 noexcept。

[noexcept(...)] QVariant::ConstReference<Indirect> ConstPointer::operator*() const

将QVariant::ConstPointer 解引用为QVariant::ConstReference 。

注意: 当std::is_nothrow_copy_constructible_v<Indirect> 为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.