A boost::variant
contains only the integral index and aligned_storage
, which is guaranteed by the standard as a POD. It has no virtual members, but has user-defined constructors and a destructor. As a result, boost::variant
not a POD and tries to memmove this to UB (well, I think it is UB, I did not find the final link in the standard).
However, the same can be said about QList
, QString
, etc. Obviously, Qt suggests that some non-POD types can be safely reproduced and distinguish between POD (so-called "primitive types") and "movable types".
Therefore, if you consider memmove QList
safe, you can safely consider memmove boost::variant
contain memmovable types.
source share