
I've a class like this:
class Example{ int str[BSize]; int *p; };
Where p points to next available element (p==str+BSize is possible when it is full). I.e. str is like begin() and p is like end(). I want to add a serialize() function, something like this:
template<class Archive> void serialize(Archive &ar,const unsigned int){ ar & BOOST_SERIALIZATION_NVP(buf,p); }
but there seems to be no support for buffers like this?
Of course the following would work: ar & BOOST_SERIALIZATION_NVP(buf,str); but it would copy too many elements. Or you might try the following (non-portable) idea ar & BOOST_SERIALIZATION_NVP(buf, make_binary_object((p - str)* sizeof(int), str) ); But really, I think you might be best off replacing the class above with class Example { std::slist<int> str; // or maybe std::vector<int> str } For which serialization is already implemented. Robert Ramey