Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost serialization omit version for a wrapper

How can I tell boost that for a particular structure it should not write/read a class "version" identifier?

I am writing some wrapper classes for serializing some types in a smaller fashion (like a variable length integer). If the wrapper gets a class version written the whole point of the size reduction is lost (it'll end up bigger in most cases).

For example, given integer a I'll be replacing this code:

ar & a;

with this:

ar & wrapper(a);

I see the is_wrapper trait, but I can't really find any docs on what that does, or if it might help.

like image 747
edA-qa mort-ora-y Avatar asked Jun 19 '26 12:06

edA-qa mort-ora-y


1 Answers

Add

BOOST_CLASS_IMPLEMENTATION(wrapper, boost::serialization::object_serializable)

It's the documented way.

like image 141
Yakov Galka Avatar answered Jun 21 '26 01:06

Yakov Galka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!