Boost logo

Boost Users :

From: Joseph Fradley (joe.fradley_at_[hidden])
Date: 2008-01-29 09:56:25


"Joseph Fradley" <joe.fradley_at_[hidden]> wrote in message
> > news:f7907c850801281226ra033ea4tda49655c0964339d_at_mail.gmail.com... Is it
> > possible using the boost serialization libraries to serialize pointers to PODs, such
> > as integers? I have tested successfully with pointers to classes but have not been
> > able to get pointers to non-polymorphic serialized. Is this a known issue?
> >
> > Joe

> > On 1/28/08, Robert Ramey <ramey_at_[hidden]> wrote:
> >
> >
> > Pointers to primitives are not tracked. See implementation level. If you really need
> > to do this, use BOOST_STRONG_TYPEDEF to make a type which is not primitive.
> > Check the documentation regarding serialization traits.
> >
> > Robert Ramey

> > On 1/29/08, Joseph Fradley <joe.fradley_at_[hidden]> wrote:
> > Thanks, I'll check it out.

Thanks, that worked. I added a non-intrusive serilaze() function
because I didn't want to mess with the macro, below is what I used
for 'int'

////

BOOST_STRONG_TYPEDEF(int, int_type)

// serialize function for int_type
namespace boost {
namespace serialization {

template<class Archive>
void serialize(Archive & ar, int_type & g, const unsigned int version)
{
    ar & make_nvp("value", g.t);
}

} // namespace serialization
} //

Joe


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