[Qt-interest] Iterators and implicitly shared containers
Sean Harmer
sean.harmer at maps-technology.com
Fri Dec 17 23:42:46 CET 2010
On 17/12/2010 21:37, Scott Aron Bloom wrote:
> Yes... however, the *it=2; should recognize that the ref count> 1, and
> do a detach/deep copy as necessary no??
Hmm true. It is the call to begin() that performs the detach at present.
Maybe a call to detach() should be added to
QVector::iterator::operator*() (amongst others). Although then the
iterator class would have to also store a pointer to the corresponding
QVector (unless it is calculable from the T* pointer already there).
The above only applies if QVector is built with QT_STRICT_ITERATORS
though. If not then the iterator is simply a typedef for a plain T*.
Cheers,
Sean
More information about the Qt-interest-old
mailing list