#include #include #include #include #include "testlib.hpp" int main() { using boost::archive::text_iarchive; using boost::archive::text_oarchive; using namespace std; boost::shared_ptr p0(new Base), p1(new Derived); stringstream storage(ios::in | ios::out | ios::binary); text_oarchive oa(storage, ios::binary); cout << "storing p0...\n"; oa << p0; cout << "storing p1...\n"; oa << p1; text_iarchive ia(storage, ios::binary); boost::shared_ptr p2, p3; cout << "loading p2...\n"; ia >> p2; cout << "loading p3...\n"; ia >> p3; p2->identify(); p3->identify(); return 0; }