[Development] implicit sharing and iterators in qt containers

Kevin Kofler kevin.kofler at chello.at
Mon Jul 31 23:26:49 CEST 2017


Mandeep Sandhu wrote:
> For implicit sharing, I'll have to this instead when a non-const function
> is called for the first time on the copy. This will cause a penalty when
> calling such a function as the hash has to be repopulated with all entries
> (eg: calling remove on the copy will take linear time instead of constant,
> although subsequent calls will have no penalty). Still thinking about it.

Well, that's the Qt way: to avoid copying until you really have to. The 
unshared container you currently have is not very idiomatic Qt.

        Kevin Kofler




More information about the Development mailing list