c++ - Can I safely memmove around a boost variant? -
i have class wrapping boost variant contains memmovable types (qlist, qstring, int etc).
may declare wrapper class memmovable qt containers?
a boost::variant
contains integral index , aligned_storage
, guaranteed standard pod. has no virtual members, has user-defined constructors , destructor. consequence, boost::variant
not pod , trying memmove ub (well, think ub, don't find definitive reference in standard).
however, same can said qlist
, qstring
, etc. apparently, qt assumes non-pod types can safely memmoved, , makes distinction between pod (so-called "primitive types") , "movable types".
consequently, if think safe memmove qlist
, can consider safe memmove boost::variant
containing memmovable types.
Comments
Post a Comment