Boost logo

Boost Users :

Subject: [Boost-users] [serialization] serialization of an ifstream/ofstream class member
From: Pablo Madoery (madoerypablo_at_[hidden])
Date: 2014-03-28 09:09:44


Hi. Do You know if there is a way to serialize an ifstream/ofstream class
member.

I have this class for example

class Object
{
public:

Object();
Object(string name);
virtual ~Object();
string getName() const;

private:

string name_;
ifstream file_;

friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & name_;
ar & file_;
}
};

when I try to serialize it throw compilation error :
error: 'struct std::basic_ifstream<char>' has no member named 'serialize'.

Is there a specific header i must include ?



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