cereal
cereal copied to clipboard
Inheriting from JSONOutputArchive
While deserializing in JSON we can serialize only the id as integers, but I want to resolve them as references. For this, I need a context. One way is custom archives, with inheritance (or a better wat, if is supported). Is it supported by cereal ? Or does cereal supports custom contexts ? Didn't found about it on documentation.
struct BigObject
{
int id;
double data[100];
}
struct A
{
BigObject& bo;
template<typename Archive>
void serialize(Archive& ar)
{
ar(bo.id); // Working for serializing, but not deserializing
ar.deserializeBigObject(bo); // With custom class
}
}
I know cereal does not supports references, but I can't use smart pointers since the BigObjects are not stored in the same archives as A.