title: boost::serialization: is it possible to avoid template functions?
body: <p>I have a struct from external library for which I wrote some non-intrusive serialization methods. Also there's my wrapper for this struct, and I'm trying to keep all dependencies from external struct to this wrapper. The problem is, all serialization methods are template, so they are defined in header files and propagate dependency from the external library to everyone serializing the wrapper, which I'm trying to avoid. Is it possible to solve this problem?</p>
  
  <p>UPD: Initially I had something like this:</p>
  
  <pre><code>// serialization.h
  
  #include &lt;external_library.h&gt;
  
  template &lt;typename Archive&gt;
  
  void serialize(Archive&amp; archive, ExternalStruct&amp; external_struct, const unsigned int version) {
      // ...
  }
  </code></pre>
  
  <p>Then I tried to make the serialization function non-template for the specific type of archive:</p>
  
  <pre><code>// serialization.h
  
  #include &lt;boost/archive/binary_iarchive.hpp&gt;
  #include &lt;boost/archive/binary_oarchive.hpp&gt;
  
  struct ExternalStruct;
  
  void serialize(boost::archive::binary_iarchive&amp; archive, ExternalStruct&amp; external_struct, const unsigned int version);
  void serialize(boost::archive::binary_oarchive&amp; archive, ExternalStruct&amp; external_struct, const unsigned int version);
  
  // serialization.cpp
  
  #include &lt;external_library.h&gt;
  #include "serialization.h"
  
  void serialize(boost::archive::binary_iarchive&amp; archive, ExternalStruct&amp; external_struct, const unsigned int version) {
      // ...
  }
  
  void serialize(boost::archive::binary_oarchive&amp; archive, ExternalStruct&amp; external_struct, const unsigned int version) {
      // ...
  }
  </code></pre>
  
  <p>But then I get many compile errors:
  <code>no type named 'type' in 'struct boost::mpl::greater&lt;boost::serialization::tracking_level&lt;ExternalStruct&gt;, mpl_::int_&lt;0&gt; &gt;'
       BOOST_STATIC_WARNING(typex::value);</code></p>