|
Boost Users : |
Subject: Re: [Boost-users] [serialization]conflictingdeclaration(BOOST_CLASS_EXPORT)
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-09-25 16:57:41
Emil Dotchevski wrote:
> On Thu, Sep 25, 2008 at 9:59 AM, Robert Ramey <ramey_at_[hidden]> wrote:
> Could you point me to the documentation that describes the alternative
> to BOOST_CLASS_EXPORT mechanism to register base/derived types? I
> found the void_cast_register function but there should be more to it
> since the various templates for serializing user types need to be
> instantiated for the different archives, right?
Look at the archive class. It contains a function call "register"
which is used as ar.register(static_cast<myType *>(0)); This
will "register" myType in archive instance ar. This is 100%
failsafe and portable. Perhaps you might want to do something
like
template<class Archive>
void
register_all_my_types(Archive &ar){
ar.register(static_cast<myType *>(0));
ar.register(static_cast<myType2 *>(0));
...
}
{
text_oarchive oa(..);
register_all_my_types(oa);
ar << x;
ar << y;
...
}
>
> Emil Dotchevski
> Reverge Studios, Inc.
> http://www.revergestudios.com/reblog/index.php?n=ReCode
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