Can you cast an object to a string of hex data (similar to how packets are sent) and then store that and then cast the object back? I know its possible with C structs which
No. Reasons:
a) Dynamic allocated memory, ie. pointer in the struct/class.
b) Endianess, int-size, padding etc. of the struct, order of the members...
Other things:
"If" it would be possible, there is no reason to create a full object
with constructor call before overwriting it.
And in my opinion, you´re overusing auto.