Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一般来说,深拷贝Qt容器的正确方法是什么?我不担心递归地深度复制容器,尽管解决这个问题会有所帮助。
尽管每个人都会告诉你——你不深拷贝 Qt 容器——在某些情况下你只需要执行一个实际的深拷贝而不仅仅是一个浅拷贝。为此,请使用detach():
detach()
container1 = container2; container1.detach();