Boost logo

Boost :

Subject: Re: [boost] [explore] Library Proposal: Container Streaming
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-12-01 12:19:17


Robert Ramey wrote:

>>> Robert Ramey
>>
>> It didn't require learning to use Boost.Serialization.
>
> Here is what you're example looks like with boost serialization
>
> #include <iostream>
> #include <boost/serialization/vector.hpp>
> #include <boost/serialization/map.hpp>
> #include <boost/serialization/list.hpp>
> #include <boost/serialization/string.hpp>
> //#include <boost/date_time.hpp>
> #include <boost/archive/text_oarchive.hpp>
> int main(int argc, char * argv[]){
> boost::archive::text_oarchive output_log(std::cout);
> // simple vector example
> std::vector<int> vi;
> vi.push_back(1);
> vi.push_back(2);
> vi.push_back(3);
> output_log << vi;

While this is possible, with a custom archive class, I hope you'll agree that it
will be rather heavyweight solution, while a simple output of output of std::vector
can be implement in a 3-line template function.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk