Boost logo

Boost Users :

Subject: Re: [Boost-users] Serializing of object with map and multimap. Questions.
From: B Hart (bhartsb_at_[hidden])
Date: 2009-11-06 04:11:16


I've noted that if in the load I don't have ia >> *this; then I
get unsupported_class_version when compiling. However, I've also noted that
Store creates nearly identical archive files whether it is:

oa << this;

or

oa << *this;

???

 the file stores and loads ok if both are with '*', but I'm unclear as
to why the boost library creates almost identical archives.
 The only difference I can tell is one has a newline following the version
info. and one doesn't. I recall it is the one with the newline that then
won't load.

I'll add, the data that is stored is also
still suspect as it does not seem to be having numbers I would expect,
so I'm going to do more checking tomorrow.

On Thu, Nov 5, 2009 at 12:44 AM, Matthias Troyer <troyer_at_[hidden]>wrote:

>
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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