Boost logo

Boost :

Subject: Re: [boost] [serialization] Must the objects being serializedoutlivethe archive?
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-09-15 12:40:25


Robert Ramey wrote:
> But I'm intrigued why you want to do this? Why don't you just use
>
> {
> std::ofstream stream(kFilename, std::ios::binary);
> boost::archive::text_oarchive oa(stream);
>
> {
> const Strings s("Hello", "World"));
> oa << s
> }
> ...
> }

or maybe
{
    std::ofstream stream(kFilename, std::ios::binary);
    boost::archive::text_oarchive oa(stream);

    {
        boost::scoped_ptr<Strings> s;
        const Strings * s = new Strings("Hello", "World"));
        oa << s;
        .... // same for all the other stuff
        // s deleted as it goes out of scope
    }
    ...
}

>
> Robert Ramey
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


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