Serialization of object references

A reference to a reference-counted object is serializable if the object's class defines the serialize() template function, and either the class has a default constructor, or a custom traits class is used when deserializing with an implementation of classcreate() that takes care of constructing a new object references. If C is a class that meets these requirements, a x::ptr<C> can be serialized and deserialized. If the x::ptr<C> is an undefined reference, and serialized, deserialization results in an undefined reference. Otherwise a new instance of C, referenced by the x::ptr<C>, gets instantiated, then deserialized.


If x::ptr<C> is actually a reference to some subclass of C, only the C superclass gets serialized, and deserializing puts a reference to the C object into the x::ptr<C>.