
A couple of comments/questions:
int main() { C c; c.setData("Hello world"); vector <C*> v; v.push_back(&c); // how do you expect to load (de-serialize) this? //... ar << c << c; // why have more than one here? }
To have a c with meaningfull data, it cannot be const.
but a reference to a const can be passed
I cannot create a local object that is a copy of the object (it is noncopyable)
use a reference
I do not think making the object untracked would be a good idea in this case (I might be wrong ?)
why not? What's the point of storing multiple copies if they are all the same?
So far, the best way I found to be able to serialize this object is :
C const & cForSerialize = c; ar << cForSerialize << cForSerialize;
But I do not think this is really elegant code. Is there a better alternative ?
factor our a save_function save_all(const C & c){ ar << c << c; } then use save(c) - only one possibility. Robert Ramey