[Interest] QVector / std::vector and memory alignment
Thiago Macieira
thiago.macieira at intel.com
Thu Dec 29 04:26:33 CET 2016
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
More information about the Interest
mailing list