Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost serialization] non intrusive & derivated class
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-06-22 10:04:26


Zitat von agrosjea <arnaud.grosjean_at_vide.eu>:

>
> I actually found a way to use friendship in my sample code. It looks like
>
> class Father{
> protected :
> string who;
> template<class Archive>
> friend void serialize(Archive& , Father&, const unsigned int);
> public :
> Father(){ who = "father";};
> virtual void whoAreYou(){ cout << "Hello, I am the " << this->who << endl;
> };
> };
>
> Seems to work but is it the cleanest way to make it ?

nothing wrong with that.

class A{
   template<class Archive>
   friend void serialize(Archive &,A &,unsigned int){
   }
};

should be equivalent to

class A{
   friend class serialization::access;
   template<class Archive>
   void serialize(Archive &,unsigned int){
   }
};


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