Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Strange warning + serialization of template derived class
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-02-13 15:15:54


dada_at_[hidden] wrote:
> Hi all,
>
> First problem:
> --------------
> i have this warning.
> "...... boost/mpl/print.hpp:55: warning: comparison between signed and
> unsigned integer expressions"

the serialization library used this to indicate usage of the library which
is permited though probably not a good idea. Check the compile
error listing to find what calls this. This should show some place
where BOOST_SERIALIZATION_STATIC_WARNING is
invoked. There you should find an explanation of why such a
warning was emitted.

>
> Second problem:
> ---------------
> I want to serialize a template derivate class like this:
>
>
> ////////////////////////////
> class Base
> {
> private:
> friend class boost::serialization::access;
>
> template<class Archive>
> void serialize(Archive &, const unsigned int )
> {
> }
> };
>
> template<typenmame T>
> class Child: public Base
> {
> private:
> friend class boost::serialization::access;
>
> template<class Archive>
> void serialize(Archive &ar, const unsigned int )
> {
> ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
> }
> };
>
> BOOST_CLASS_EXPORT_GUID(Child<int>, "Child")//don't work
> ///////////////////////////
>
> The macro "BOOST_CLASS_EXPORT_GUID" don't work with template class.
> Is there a way to do this ?

I would guess that the <> characters are some sort of problem. Try
typedef Child<int> Child_int

BOOST_CLASS_EXPORT_GUID(Child_int, "ChildInt) // remember the name has to be
unique!!

Also there is a track item with a suggestion on how to implement the
equivalent of:

BOOST_CLASS_EXPORT(Child<int>)

Robert Ramey

> Thank you,
> Regards,
> Damien.


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