memcpy simply copies bytes in memory, so yes, you can do this. Whether you should or not isn't so easily answered. If the object you're copying is pure data, there probably won't be any problems, but if there's stuff like pointers or references involved, or a class or struct that does something like reference counting, this could be a bad idea. You need to be very sure you understand the object you're attempting to copy, or at least be prepared for a long, unpleasant debugging slog if things go south.