boostorg / serialization

Boost.org serialization module
http://boost.org/libs/serialization
120 stars 139 forks source link

C++ #286

Closed ArielSilver closed 1 year ago

ArielSilver commented 1 year ago

struct base { virtual std::string get_name () { return STRUCT_STR(base); } template void serialize(Archive &ar, const int version) { } };

struct A : public base { virtual std::string get_name () { return STRUCT_STR(A); } template void serialize(Archive &ar, const int version) { ar & boost::serialization::base_object(*this); } };

struct B : public A { B(int _e) {e = _e;} B() {} virtual std::string get_name () { std::cout << e; return STRUCT_STR(B); }

template<class Archive>
void serialize(Archive &ar, const int version) {
    ar & boost::serialization::base_object<A>(*this);
    ar & e;
    ar & p;
}

int e;
ProcessStatus p = UNINITIALIZED;

};

void register_oa_class_type(boost::archive::text_oarchive& oa) { oa.register_type(); oa.register_type(); oa.register_type(); }

void register_ia_class_type(boost::archive::text_iarchive& ia) { ia.register_type(); ia.register_type(); ia.register_type(); }

robertramey commented 1 year ago

what is this? May I close this issue?