Boost logo

Boost Users :

Subject: [Boost-users] [serialization] slow compile times with archive register_type
From: Elizabeta (elizabeta.petreska_at_[hidden])
Date: 2014-12-12 03:34:47

I am using custom archive classes. Problem is BOOST_CLASS_EXPORT_GUID is not
working with the custom archive classes, i.e I am getting unregistered class
exceptions all over the place, when saving derived class with base pointer.
Here is link to my question
about this.

So I found other way for exporting the classes, i.e with archive register
type. Exporting the classes with register_type is working well, no more
unregistered_class exceptions, but probelm is it increase the compile times
of my project by more than half. Project compile time with register_type is
40-45 minutes, and without 18-19 minutes. Here is how I am using the
register_type :

template<class Archive>
void register_all_types(Archive&);

#include "A.h"
#include "B.h"
// other classes includes
template<class Archive>
void register_all_types(Archive& a)
   ar.register_type ();
   ..... all other classes which is maybe 100
// explicit instiantion of all my archive classess

template void register_all_types(XmlWOArchive& ar);
template void register_all_types(XmlWIArchive& ar);
template void register_all_types(DbgXmlWOArchive& ar);
template void register_all_types(DbgXmlWIArchive& ar);
template void register_all_types(BinaryOArchive& ar);
template void register_all_types(BinaryIArchive& ar);
template void register_all_types(CloneBinaryOArchive & ar);
template void register_all_types(CloneBinaryIArchive & ar);
template void register_all_types(DuplicateBinaryOArchive & ar);
template void register_all_types(DuplicateBinaryIArchive & ar);

I am calling register_all_types before doing the
serialization/deserialization. And I am doing the
serialization/deserialization in multiple functions in my project not just
in one place, but this should not be problem, I mean I have the registration
done only in one cpp file i.e RegisterMyTypes.cpp, so the templates should
be instantiated only in this file, and it should be slow, right ?

Thank you for any help

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at