Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization]conflictingdeclaration(BOOST_CLASS_EXPORT)
From: Jens Weller (jensweller_at_[hidden])
Date: 2008-09-25 11:31:50


Robert Ramey wrote:

>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 mailing list
>Boost-users_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>
Thanks, this Idea works for me pretty good. And I prefer it instead of a
static intialisation of my class types.

regards,

Jens Weller


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