when serializing these things it's generally going to be best to put the tag first though. That way it's cheap to figure out how to parse it.
The serialization format, does not need to be the in-memory representation format.
Unless, you do de-serialization and serialization in tight-loop I guess is it acceptable.
NOTE: A bigger problem is when you need to decide at runtime which one of the kind you have been handled.
The serialization format, does not need to be the in-memory representation format.
Unless, you do de-serialization and serialization in tight-loop I guess is it acceptable.
NOTE: A bigger problem is when you need to decide at runtime which one of the kind you have been handled.