什么时候对QList进行深拷贝? [英] When does a deep copy happen to a QList?
本文介绍了什么时候对QList进行深拷贝?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我正在上的一堂课中,我在玩弄几个QList
.我听说Qt尽可能不制作列表的深层副本.据我了解,这意味着在执行此操作时不会发生任何深层复制:
In a class I'm working on, I am juggling several QList
s. I have heard that Qt tries not to make deep copies of lists whenever possible. From what I understand, that means that no deep copy happens when you do this:
QList<int> myList;
myList << 1 << 2 << 3 << 4;
QList<int> otherList = myList; // No deep copy
在某些情况下,我需要确保QList
绝不会复制深层副本.为了确保我所使用的QList
绝不会复制深层副本,我到底需要避免哪种操作或动作?
In some cases, I need to make sure a deep copy never happens to the QList
. Exactly what kind of operation or action do I need to make sure to avoid in order to make sure a deep copy never happens to a QList
I'm working with?
推荐答案
查看全文