[Qt-interest] Iterators and implicitly shared containers
Ben Swerts
benswerts at telenet.be
Sat Dec 18 17:23:37 CET 2010
>>however, the *it=2; should recognize that the ref count > 1, and
>>do a detach/deep copy as necessary no??
>>
>>Soctt
This is what I would expect,
but I afraid that you can't achieve it at least with current implementation
of iterators/containers sharing in Qt.
The way to fix your code is to obtain iterator after assignment.
Modification below will produce results you expected, cause detachment will
be done when v1.begin() is called.
If I were you I would try to report the bug. If not fixed it will be good at
least to have a special warning in documentation which identifies possible
problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101218/c4dcb5a5/attachment.html
More information about the Qt-interest-old
mailing list