Objects that are not simple aggregates cannot be memcpy'ed. A simple aggregate is defined as a struct or class that contains no member functions, constructors, or destructors.
I thought member functions were ok, just not virtual member functions.
- no ctor
- no dtor
- no virtual functions
- no virtual parent classes
- no parent classes that have any of the above
- no member vars that have any of the above.
if all the above are true, you have a POD type. Otherwise you don't.
At least that's what I remember.
But yeah, strings are not POD types. Therefore you cannot memcpy them. You should avoid memcpy for just this reason, it performs a "dumb" binary copy which doesn't play nice with complex objects. Prefer std::copy instead, which will work with complex types.