Op 21/01/2016 om 08:00 schreef Marc Mutz:
On Thursday 21 January 2016 05:24:35 Kevin Kofler wrote:
Marc Mutz wrote:
On Wednesday 20 January 2016 22:50:43 Kevin Kofler wrote:
All these are horrible and error-prone hacks that have obvious lifetime
issues. You are complaining about Qt containers because the detaching
can invalidate iterators. Well, the lifetime issues you introduce with
the above proposed solutions are much worse! And a caching mutable
member also destroys thread-safety (in addition to the obvious lifetime
issue that the next call surprisingly invalidates your existing
reference).
One word: QModelIndex.
And that class is the source of innumerable bugs. The fact that one Qt
class has such broken semantics is no excuse for putting them everywhere.
Indeed, it is. You will find cases where QModelIndex is stored somewhere
in many places, also in code writen by people who should know better.
So how would you have designed it, then?
I would have designed something that stays valid. But that's another
discussion for another thread.
André
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development