[Development] QList
Marc Mutz
marc.mutz at kdab.com
Fri May 26 13:31:49 CEST 2017
On Thursday 25 May 2017 18:40:46 Christoph Feck wrote:
> If you only return a view to the container, then if the container is
> modified, the return value is no longer valid. Returning a full
> container (referenced, with copy-on-write semantics) will not have this
> problem.
If you return a vector of QRects from QRegion, then modify the QRegion, the
rectangles you have a no longer valid, either. Yes, the program will not
crash, nor will Valgrind complain. But it will use outdated information.
If you use the QRegion::begin/end(), and you do the same mistake, you get a
crash or valgrind complains.
So what you said is that you'd rather have the API hide your mistakes from you
than to point them out to you.
Interesting approach. I wish you luck persuing it.
Thanks,
Marc
(seriously considering installing Gnome now)
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
More information about the Development
mailing list