From 20848f6e8316fc440202a3bc193956aee7a00b5a Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 12 Jul 2020 14:43:21 +0200 Subject: [PATCH] QVLA: use std::aligned_storage Remove the hand-rolled union used only to achieve alignment. Change-Id: I8e635fa0d09042f30fd67d589db9bc384c0ec8ef Reviewed-by: Thiago Macieira --- src/corelib/tools/qvarlengtharray.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index fccdfad081d..a70fc75fcfd 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -293,11 +293,7 @@ private: qsizetype a; // capacity qsizetype s; // size T *ptr; // data - union { - char array[Prealloc * sizeof(T)]; - qint64 q_for_alignment_1; - double q_for_alignment_2; - }; + std::aligned_storage_t array[Prealloc]; bool isValidIterator(const const_iterator &i) const {