I am currently serializing data in a class in which a member function is called and passed the data and I declare a static boost::archive in that function and serialize the data to a binary file. This works fine when I deserialize (in a while loop with EOF condition) but now I would like to serialize to the same file/archive from other functions in the class. The Boost tutorials do not show any other way to intialize an archive.
Basically I want to declare a boost::archive::binary_oarchive as a member variable. Problem is, how do I initialize it, say, in the constructor after I have opened a file stream? My instinct tells me this is not allowed, but I was hoping there was a way to do this.
(FYI, I've tried to serialize by declaring different instances of the archive file in each function with a common file stream, but on deserialization, i get an "invalid signature" exception).