Re: [Boost-users] serialization and ::copyFrom

Robert Ramey wrote:
Oh, that should be easy:
D1 *d1p;
ar << d1; ar >> *d1p;
Robert Ramey
Hi,At> ar << d1;> ar >> bp; // but "bp" points already to an object of type D1I meant : "bp" is "Base* bp"So, if I call ar >> *bp; the Base::load will be called, not the derived D1:load.Actually more precisely, I intend to do solass Base { ... virtual .. } class D1 : public Base { } Base* bp1 = new D1(..some thing..); Base* bp2 = new D1(..some thing else..); ar << *bp1; ar >> *bp2; This means for all my serializable classes I have a kind of "=" operator defined. regards, Andrei _________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

If this is what your want to do I think you would be better off with
lass Base {
...
virtual ..
}
class D1 : public Base {
}
Base* bp1 = new D1(..some thing..);
Base* bp2;
ar << bp1;
ar >> bp2;
this might require registration or export though.
Robert Ramey
"Andrei Popa"
Oh, that should be easy:
D1 *d1p;
ar << d1; ar >> *d1p;
Robert Ramey
Hi, At
ar << d1; ar >> bp; // but "bp" points already to an object of type D1
I meant : "bp" is "Base* bp" So, if I call ar >> *bp; the Base::load will be called, not the derived D1:load. Actually more precisely, I intend to do so lass Base { ... virtual ..}class D1 : public Base {}Base* bp1 = new D1(..some thing..);Base* bp2 = new D1(..some thing else..); ar << *bp1; ar >> *bp2; This means for all my serializable classes I have a kind of "=" operator defined. regards, Andrei ------------------------------------------------------------------------------ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it! ------------------------------------------------------------------------------ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Andrei Popa
-
Robert Ramey