[Development] QHash iteration vs std::unordered_map
Marc Mutz
marc.mutz at kdab.com
Mon Apr 17 09:30:23 CEST 2017
On Monday 17 April 2017 00:59:55 Thiago Macieira wrote:
> Em domingo, 16 de abril de 2017, às 15:16:54 PDT, Mark Gaiser escreveu:
> > Ohh, that's great!
> >
> >
> >
> > One question. Would it be possible and sane to - by default - provide
> > it as the patch implements it there, but with the addition of a define
> > that can influence the behavior of the iterators?
>
> Most llikely no. Just look at the problem that QT_STRICT_ITERATORS causes.
> We shouldn't make the same mistake again.
The problem with QT_STRICT_ITERATORS is _not_ that they are changing begin()
and end(), but that a) classes that shouldn't be (non-polymorphic ones), are
exported, thus breaking patterns that are deeply ingrained in C++ developers
(inline function no longer are inline, e.g.) and b) that classes that
shouldn't be (non-polymorphic ones with public dtor), are inherited.
_These_ are the things that need fixing, not QT_STRICT_ITERATORS, or a
hypothetical QT_STL_COMPATIBLE_ITERSTORS, even though I consider the former,
too, a kludge.
Thanks,
Marc
--
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