title: Setting a property that I can access in the serialize functions when using Cereal serialization library
body: <p>I'm using the 'Cereal' serialization library (uscilab.github.io/cereal/) to serialize objects that can have millions of numbers, and the meta-data that describes the numbers.  In some instances, I do not need the numbers to be serialized, just the meta-data; other times I would like both in the archive.</p>
  
  <p>The only way I could think to achieve was to add a boolean property to the OutputArchive class defined in the cereal.hpp file.  My thinking is that when I construct the archive, I set this value.  Then, when the serialization code runs, any object could access this property and serialize the appropriate values.  Most objects would ignore this property, but the objects holding the (potentially) millions of numbers could either ignore the numbers or not, based on the value of this property.</p>
  
  <p>Here is some pseudocode to help explain (derived from the examples on the Cereal website). Creating an archive would look like this:</p>
  
  <pre><code>int main()
  {
    std::stringstream ss;
  
    {
      cereal::BinaryOutputArchive oarchive(ss, true); // I modified the constructor to accept a boolean parameter, and set the property
      ...
    }
  ...
  </code></pre>
  
  <p>Then, within the function that serializes my data object (the object that holds metadata and the millions of numbers):</p>
  
  <pre><code>template&lt;class Archive&gt;
  void save(Archive&amp; ar) const
  {
      ar(metadata);
      ar(more_meta_data);
  
      boolean bArchiveEverything = ar.ArchiveNumbers(); //&lt;&lt;-- this is what I don't know how to accomplish
  
      ar(bArchiveEverything); // put this into the archive, so I know what to expect when deserializing
      if (bArchiveEverything) {
          ar(bigVectorOfNumbers);
      }
  }
  </code></pre>
  
  <p>My questions:</p>
  
  <p>1) Am I going about this all wrong?  Is there a simpler more elegant way I'm missing?</p>
  
  <p>2) If not, and this seems reasonable, I'm not sure how I can access my property in the OutputArchive through the 'Archive&amp;' parameter that gets passed into the template functions that Cereal needs for serializing. </p>
  
  <p>Thanks in advance for any help.</p>