On 18/03/2021 08.10, Roland Hughes wrote:
https://www.logikalsolutions.com/wordpress/information-technology/qlist/
You can also take a big hit if there happens to be 100+ things
referring to this particular value instance when it needs to change.
Think a working/scratch object you load a “default” value into from
some external source then use to initialize a hundred element list.
Not an integer, but a substantial object like a page of text or a
QPixmap image. Later on in the code your working QPixmap needs to
load a different image. That image pays the price. A hundred copies
now have to be made before the first image change can happen. The
second image change pays no such price so it is very fast.
Uh... that's not true. When you need to change a shared object, the one
*being changed* gets copied. The other 99 continue to point to the old
object, the new one points to a new object that you just created. *One*
copy, not one hundred... which you needed to pay for anyway; CoW just
delays payment until you definitely need the copy instead of when you
logically make the copy.
--
Matthew
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest