Boost logo

Boost Users :

From: Cheok Yan Cheng (yccheok_at_[hidden])
Date: 2006-07-23 14:48:34


Hi, I am trying to perform serialization on a const
member

const ImageRegion* imageRegion;

By refering to
http://www.boost.org/libs/serialization/doc/serialization.html#const,
I thought the following code would work.

    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int
version)
    {
        ar & const_cast<ImageRegion *>(imageRegion);
    }

However, I still get the following error is VC++ 2003

c:\yccheok\pcbvisionlib\FiducialPair.h(42): error
C2679: binary '&' : no operator found which takes a
right-hand operand of type 'ImageRegion *' (or there
is no acceptable conversion)

I had fully tested the ImageRegion class. Before this
const member variable, it can be fully serialized with
no problem.

Any suggestion? Thank you!

p/s

By refering to the mailing list "(de)serializing
vector<const A*>"

http://groups.google.com/group/boost-list/browse_frm/thread/79dba906901d039f/38ac71e4da0c1b3d?lnk=gst&q=serialization+const+pointer&rnum=7#38ac71e4da0c1b3d,
does it mean that boost is also not allow to
(de)serialize map<const CLASS*, CLASS> directly? Must
I iterate through the map elements one by one to
serialize them manually?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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