title: How do I register types with boost serialization in a template class?
body: <p>I am having a problem where I am trying to serialize a message of a template class. The template's class message is of type BaseClass, but I want it to serialize the derived versions of the class. As of right now, it is only serializing the BaseClass. How am I supposed to register with boost::serialization the types of the derived classes that I want it to serialize? I have tried several methods such as using the 'BOOST_CLASS_EXPORT' macro. Also I have tried using this example:</p>
  
  <pre><code>ar.register_type(static_cast&lt;bus_stop_corner *&gt;(NULL));
  </code></pre>
  
  <p>from here: <a href="http://www.boost.org/doc/libs/1_36_0/libs/serialization/example/demo_gps.hpp" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_36_0/libs/serialization/example/demo_gps.hpp</a> but still no luck. </p>
  
  <pre><code>template &lt;class T&gt;
  class Frame{
  ...
  private:
      T message;
  };
  
  class BaseType{};
  
  class SubTypeA : public BaseType{};
  
  class SubTypeB : public BaseType{};
  
  int main(){
      std::vector&lt; Frame&lt;BaseType&gt; &gt; myFrames;
      //add a bunch of Frame&lt;SubTypeA&gt; and Frame&lt;SubTypeB&gt; objects to the myFrames vector.
  
      //serialize the vector.
  
      return 0;
  }
  </code></pre>
  
  <p>This code is not compilable at all, but was included to give you an idea of the structure of my program.</p>