On Nov 26, 2009, at 10:36 AM, Sebastián Salazar Molina wrote:
> I need to store a C++ object, not a file.
Beware, there be dragons down that path:
- Pointers can't be stored directly
- Structure padding varies by compiler, OS, CPU, compiler options...
- Byte order varies among CPU types and sometimes even OS on the same CPU (PowerPC and
HP PA-RISC processors allow switchable byte order at boot time)
This general class of problems is called object serialization, and there's got to be whole
books on the topic. Academic journals even, maybe. It might be best to leave such code
up to others who have already worked out the details.
MySQL++'s answer to this question is SSQLS. Hardly comprehensive, but maybe good enough
for your purposes.