Obsolete Members for QVarLengthArray

QVarLengthArray 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。

公共函数

(deprecated in 6.3) void prepend(T &&value)
(deprecated in 6.3) void prepend(const T &value)

成员函数文档

[deprecated in 6.3] void QVarLengthArray::prepend(T &&value)

[deprecated in 6.3] void QVarLengthArray::prepend(const T &value)

自 6.3 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

这样速度会很慢。如果必须使用,请使用insert(cbegin(), ~~~)

在数组开头插入value

这与 vector.insert(0,value) 相同。

对于大型数组,这一操作可能会很慢(线性时间),因为它需要将矢量中的所有项目在内存中移动一个位置。如果你想要一个提供快速prepend() 函数的容器类,请使用 std::list 代替。

另请参见 append() 和insert()。

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