Boost logo

Boost Users :

From: Ivan (ivan.rachev_at_[hidden])
Date: 2005-08-17 12:42:40


Hi,

How could I determine the objectID of an object after it's been saved?
I mean the ID that boost::serialization generates for each object at saving.
In other words - I know the address of the object and I would like to
get its ID after it's been saved.
Does anyone know how to do that?
Example follows at the end.

Ivan

#include <boost/archive/text_oarchive.hpp>

class A {
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    { ar & i;
    }
public:
     int i;|
};

int main()
{
    std::ofstream ofs("filename");
    boost::archive::text_oarchive oa(ofs);

    A a; a.i = 1;
    oa & a;
    // need ID of *a* here !!!
}


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