|
Boost : |
Subject: Re: [boost] [serialization] In-memory archive?
From: troy d. straszheim (troy_at_[hidden])
Date: 2008-10-17 12:42:50
Ling Li wrote:
> Thanks! Using streambuffer or std::istringstream/std::ostringstream is
> indeed very convenient.
>
> Has anyone thought about introducing default values in serialization
> to save the storage size (or the number of bits tranferred over
> network)? I hacked NVP and make_nvp to support this as an optional
> feature, and it works fine for me. If that sounds something might be
> useful to others, I can paste the patch here.
You can get these numbers by making a filter device that counts bytes,
(iirc there is an example in iostreams)
or by serializing to, say, a vector<char> via via one of the iostreams
push_back devices and getting the container's size after the archive is closed.
Serializing to a vector is also convenient if you want to, say, use boost::crc
to take and transmit checksums with the data.
-t
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk