Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost serialization: specifying a template class version

I have a template class that I serialize (call it C), for which I want to specify a version for boost serialization. As BOOST_CLASS_VERSION does not work for template classes. I tried this:

namespace boost {
namespace serialization {
    template< typename T, typename U >
    struct version< C<T,U> >
    {
        typedef mpl::int_<1> type;
        typedef mpl::integral_c_tag tag;
        BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value);
    };
}
}

but it does not compile. Under VC8, a subsequent call to BOOST_CLASS_VERSION gives this error:

error C2913: explicit specialization; 'boost::serialization::version' is not a specialization of a class template

What is the correct way to do it?

like image 830
Jazz Avatar asked Sep 17 '08 12:09

Jazz


1 Answers

#include <boost/serialization/version.hpp>

:-)

like image 143
James Hopkin Avatar answered Oct 13 '22 02:10

James Hopkin