|
Boost Users : |
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-06-20 08:37:02
Ioannis Papadopoulos wrote:
> Hi,
>
> Is there any means of obtaining how big my archive will be before
> actually serializing? Something like a special boost::archive that will
> count the size of what I'm serializing. I'm mainly concerned on
> allocating exactly the space I'll be needing for binary_oarchives.
>
> I guess I should follow the SA concept (since I'm trying to find the
> size before saving) but how can I know any extra overhead?
You could probably use boost.iostream library to create a sink that
increments a size but doesnt' actually 'write' anything, then pass that
to the oarchive's constructor. Be sure to use the same oarchive type
that you will actually write to later.
Jeff
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net