[Development] Meaning of Q_PRIMITIVE_TYPE?

Marc Mutz marc.mutz at kdab.com
Tue Apr 3 10:20:11 CEST 2012


Hi,

On Tuesday April 3 2012, jedrzej.nowacki at nokia.com wrote:
[...]
> > Also, QVarLengthArray should zero-initialise, but it doesn't.
>
> I like this feature it allows to avoid double initialization in some cases,
> but maybe it is not the most intuitive behavior. Anyway it is a bit out of
> scope.

If you want to avoid double initialisation, the correct way is 
reserve()+push_back(), not resize()+operator[]. That works even for complex 
types.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions



More information about the Development mailing list