Boost logo

Boost Users :

Subject: Re: [Boost-users] Serializing of object with map and multimap. Questions.
From: Matthias Troyer (troyer_at_[hidden])
Date: 2009-11-05 03:44:31


On Nov 5, 2009, at 12:42 AM, B Hart wrote:

> void store(const char* filename){
>
>
> std::ofstream ofs(filename);
> boost::archive::text_oarchive oa(ofs);
>
> oa << this;
> }
>
> void load(const char* filename){
>
>
> std::ifstream ifs(filename);
> boost::archive::text_iarchive ia(ifs);
>
> ia >> this;
>
> }

Don't you mean oa << *this and ia >> *this? I doubt that you want a
new object created in load, but rather this object loaded from the file?

Matthias



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