Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2008-06-22 20:50:27


Sohail Somani wrote:
> 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?
>
> As others have mentioned, the only real way to do this is to effectively
> serialize twice. Once to count, once to do the the actual serialization.
>
> Out of curiosity, why do you need to do this?

FWIW, I used to use that tack when I needed a progress bar for long file
save operations. Worked a treat.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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