How to distinguish read / write operation in boost serialization?

Viewed 2850

Using the boost serialization library I have a very simple serialize() member function, something like:

template <class Archive>
  void serialize( Archive& ar, unsigned version )
  {
     ar & m_Searcher;
  }

... and I want to keep it this simple (I don't want to use splitting in particular). But in the case of writing I want to do some "preparation" for m_Searcher before actual writing to take place.

{
  if( this-is-a-writing-operation )
     do-some-preparation( m_Searcher )

  ar & m_Searcher;
}

Is there any simple way to distinguish between reading and writing operations?

1 Answers
Related