Re: [Boost-users] array deserialization problem
Thanks! I'll do that.
As for the vector, I cannot use it cos I operate with SSE on large data structures in memory. Those are the real structures I want to serialize, so I cannot use a vector. Also none of the boost libraries fit my profile for operating on data, so i'll have to stay with the pure pointers.
Anyways, thanks again :)
Regards,
MU.
Dnia 26 czerwca 2008 12:37 Matthias Troyer
On Jun 26, 2008, at 9:03 AM, michalurbanski wrote:
Thanks for the reply.
Is there any way to make it work if I want to allocate a block of memory which size depends on the other serialized elements?
For example, how do I deserialize an object with attribues constructed like this:
Test(int a, int b) { this->a = a; this->b = b; this->c = new float[a*b]; }
There are two ways:
1. The easiest: you use a std::vector instead of a bare pointer for c 2. You split serialize into save and load, and allocate the required memory in the load function before deserializing the array
I would recommend using a std::vector, unless the overhead in memory consumption of two integers is a real killer for your application
Matthias
participants (1)
-
michalurbanski