|
Boost Users : |
From: Andreas Huber (ahd6974-spamgroupstrap_at_[hidden])
Date: 2005-09-08 10:47:59
Robert Ramey <ramey <at> rrsd.com> writes:
> Hmm - I the referenced email referred to shared_ptr. Your case is covered
> in the documenation. Reference/Serializable/Pointers.
I think it is not. AFAICT what Bruno needs, is a way to *automatically*
register all instantiations of a given template. As I have recently discovered
I would have the same need when I want to add serialization to
boost::statechart::state_machine<>.
>From the documentation it seems that what the serialization library currently
supports is a way to register a type at *namespace* scope. That is, if I have
a template ...
class A {};
template< class T >
class B
{
};
... I need to *manually* register all instantiations of B, e.g. as follows:
BOOST_CLASS_EXPORT_GUID( B< int > );
BOOST_CLASS_EXPORT_GUID( B< char > );
BOOST_CLASS_EXPORT_GUID( B< double > );
BOOST_CLASS_EXPORT_GUID( B< float > );
For a library containing B's definition, sometimes you can get away with
requiring users to manually register all instantiations but often even the
users cannot know all instantiations because B is an implementation detail of
the library.
IIRC, registration within load/save (with register_type<>) is not an option,
as that would be too late.
-- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net