[Interest] QVector / std::vector and memory alignment
Philippe
philwave at gmail.com
Thu Dec 29 06:56:20 CET 2016
Good to know. It would be nice to have this mentionned in the official documentation.
Sometimes there are discussions about what is best QVector vs
std::vector, and here we have a good "plus" for QVector.
Philippe
On Thu, 29 Dec 2016 01:26:33 -0200
Thiago Macieira <thiago.macieira at intel.com> wrote:
> Em quarta-feira, 28 de dezembro de 2016, às 17:34:37 BRST, Philippe escreveu:
> > Given an aligned type such as:
> >
> > struct alignas(2048) foo
> > {
> > char t[55];
> > };
> >
> > I was pleasantly surprised that QVector<foo> provides aligned data (see my
> > example further, using Qt 5.8 RC) I could not see this officially
> > mentionned in the Qt documentation. Yet, this is obviously very useful.
> > Hence, is it a documentation omission, or "an implementation detail we
> > can't rely on" ?
>
> Yes. It's intentional and works properly for all Qt containers, save
> QLinkedList (because it uses "new") and QVarLengthArray (because you should
> revise your code instead).
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list