[Development] Meaning of Q_PRIMITIVE_TYPE?
Marc Mutz
marc.mutz at kdab.com
Thu Mar 29 09:36:20 CEST 2012
On Wednesday March 28 2012, Thiago Macieira wrote:
> - trivial default constructor ( = can be initialised by memset)
> - trivially copyable ( = memcpy creates independent object)
> [note: implies the next two]
> - movable ( = memcpy can be performed if the old object is discarded) -
> not a C++11 definition
> - trivial destructor ( = no destructor need be run)
>
> We currently only care about two combinations:
>
> - Q_PRIMITIVE_TYPE = all of them
> - Q_MOVABLE_TYPE = just the trivially-movable trait
"Trivial foo" in C++11 bans user-defined foo outright (ex: [class.ctor]/5).
Thus, Q_MOVABLE_TYPE should not mean C++-trivially-movable, because QString
(say) isn't trivially movable in the C++11 sense (has user-defined move
assignment operator).
We cannot use the C++11 terms, they're counter to existing QTypeInfo practice.
Q_MOVABLE_TYPE is equivalent to eastl::has_trivial_relocate, though nothing
of that sort exists in C++11 (yet).
> Note that when all four traits are grouped together, C++11 defines them as
> "trivial type".
And a trivial type that is standard-layout is a C++11-POD.
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