QVariant::ConstPointer Class
template <typename Indirect> class QVariant::ConstPointerQVariant::ConstPointer 是一个模板类,用于模拟指向QVariant 的常量指针。更多
该类在 Qt 6.11 中引入。
公共函数
| ConstPointer(Indirect &&pointed) | |
| ConstPointer(const Indirect &pointed) | |
| QVariant::ConstReference<Indirect> | operator*() const |
详细说明
QVariant::ConstPointer 封装指向的值,并从其 operator*() 返回QVariant::ConstReference 。这使它适合替代实际指针。我们不能从泛型迭代器中返回实际指针,因为迭代器并不持有实际的QVariant 。
成员函数文档
[explicit noexcept(...)] ConstPointer::ConstPointer(Indirect &&pointed)
从pointed 到值构造QVariant::ConstPointer 。
注: 当std::is_nothrow_move_constructible_v<Indirect> 为true 时,此函数为 noexcept。
[explicit noexcept(...)] ConstPointer::ConstPointer(const Indirect &pointed)
从pointed 到值构造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.