|
Boost : |
Subject: Re: [boost] [explore] Library Proposal: Container Streaming
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-12-01 12:43:21
Vladimir Prus wrote:
> 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,
Hmmm - I realize that the serialization library has a lot of template
code. But to me the issue is conceptual "heaviness".
In both libraries, the idea is to wrap extra information about types
so that they can easily be displayed on a stream. In either library
you just write
#include ...
...
output_stream << data
I just don't see the value in re-inventing of a whole new wheel.
By the time such a library would pass the
boost review process, I'm sure it would be just as heavy
weight (or more) than boost serialization.
One would have a whole new interface to to something that
is less capable.
Already the serialization library has an xml_archive as well
as text archive.
> while a simple
> output of output of std::vector can be implement in a 3-line template
> function.
I didn't have to write even one line to template code to
implement the example.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk