Well, the subject says it all...
Thanks.
Well, the subject says it all...
Thanks.
Most objects in Qt implement copy-on-write mechanism. Which means that you get a shallow copy, which becomes a deep one as soon as you try to change it.
Could you explain that a bit more - or post a link to where this is to be found in the docs?Which means that you get a shallow copy, which becomes a deep one as soon as you try to change it.
Thanks.
In a nutshell, assignment operators in Qt are cheap. There's a lot of implicitly shared classes in Qt, and they're all cheap. Don't feel afraid to use them. Don't feel afraid to read the docs.
Its not about it being cheap or not.In a nutshell, assignment operators in Qt are cheap. There's a lot of implicitly shared classes in Qt, and they're all cheap.
I knew that in Qt3 usually shallow copy was used.
It is important when you need to write your own copy constructors.
The key thing here is what jacek said about copy-on-write mechanism.
If this was not the case, I'd have to use explicit deep copy in my copy constructor.
DoesDon't feel afraid to read the docs.tells you I am afraid of reading the docs? ;-)or post a link to where this is to be found in the docs?
@ user3me : thanks, I found it my self in the mean time.
Bookmarks