[serialization]Serializing a static vector
I have a class with a static STL vector as a member. The elements of this vector are themselves serializable classes. Can this vector be serialized? Is so, how? Merrill
No one has ever thought of this before. I don't see a problem doing it in the normal way. However, there would be a couple of things to keep in mind: The tracking behaviour. I would recommend that the particular vector be marked as tracked. That way you'll only get one copy of the static vector in the archive. Of course if something like std::vector<int> then this approach would have some disagreable side effects. So I would recommend deriving a class from std::vector<int> and assigning track_always to it. Robert Ramey Merrill Cornish wrote:
I have a class with a static STL vector as a member. The elements of this vector are themselves serializable classes. Can this vector be serialized? Is so, how?
Merrill
Of course, if there was a type trait "is_static_variable" we could just build that behavior into the default tracking level mpl. Robert Ramey Merrill Cornish wrote:
I have a class with a static STL vector as a member. The elements of this vector are themselves serializable classes. Can this vector be serialized? Is so, how?
Merrill
participants (2)
-
Merrill Cornish
-
Robert Ramey