Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-07-23 23:33:44


> Here is the full source code. Any suggestion? Thank
> you very much!

Try the change below:

Robert Ramey

>
> #include <iostream>
> #include <sstream>
> #include <fstream>
>
> using namespace std;
>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>
>
> class dd
> {
> private:
> friend class boost::serialization::access;
> template<class Archive>
> void serialize(Archive & ar, const unsigned int
> version)
> {
> ar & i;
> }
>
> int i;
> };
>
> class dummy
> {
> public:
> dummy() : d(0){}
> ~dummy(){}
>
> private:
> friend class boost::serialization::access;
> template<class Archive>
> void serialize(Archive & ar, const unsigned int
> version)
> {
//*** replace this:
> //ar & const_cast<dd *>(d);
//*** with this
        //ar & const_cast<dd * &>(d);
> }
>
> const dd *d;
> };
>
> int main()
> {
> const dummy w;
> dummy r;
>
> // make an archive
> std::ofstream ofs("dummy");
> boost::archive::text_oarchive oa(ofs);
>
> oa << w;
>
> std::ifstream ifs("dummy");
> boost::archive::text_iarchive ia(ifs);
>
> ia >> r;
> }
>
>
> c:\Documents and
> Settings\yccheok\Desktop\xxx\main.cpp(34): error
> C2679: binary '&' : no operator found which takes a
> right-hand operand of type 'dd *' (or there is no
> acceptable conversion)
>
> __________________________________________________
> 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