Peter Soetens wrote:
On Thu, Sep 17, 2009 at 18:33, Robert Ramey
wrote: Peter Soetens wrote:
I might do what you suggest or look for another serialization solution.
Given the limited scope of what you want to do, it wouldn't be THAT hard to make your own archive. Take a look at "trivial_archive" in the documentation and build from that.
Encouraged by your and Stefan's suggestions, I've spent another day at looking what the possibilities are.
1. I first created my own binary_?archive classes which inherited from common_?archive. This resulted in pulling in the library with the 'behind the scenes type tracking'. It seems, inheriting from common is not an option for me if I want 'zero-allocation' serialization. Correct ? (I also tested the demo_fast_archive.cpp extended with no_header, but that one also allocated).
That includes too much - I guess you've verified that.
2. I then tried to work further on Stefan's code snippet. It works, but indeed only for 'primitive_type's. I *think* I need functionality upto the 'object_serializable' if I want std::vector<T> as well. Since Stefan's operator& consumes every T, I'll need one operator& for each primitive type, and then an operator& that tries to save/load using free functions of the not primitive type.
3. It looks that I'll have to implement the Archive concept from scratch or at least based on Stefan's code and the load_binary/save_binary code from binary_?archive.
Am I on the right track ?
Sounds like it to me. You might have to borrow some other pieces from other archive implementaions. Robert Ramey
Peter