When does a deep copy happen to a QList?

前端 未结 3 824
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-11 16:27

In a class I\'m working on, I am juggling several QLists. I have heard that Qt tries not to make deep copies of lists whenever possible. From what I understan

3条回答
  •  一整个雨季
    2021-01-11 16:43

    When you pass a QList as a argument of a function or when you create copies without modifying it Qt just pass a "wrapper", the real data is never copied along. Implicit sharing is the Qt implementation of the Flyweight pattern, see here.

提交回复
热议问题