Boost logo

Boost Users :

Subject: Re: [Boost-users] Extend boost binary serialization with varints encoding
From: Ernest Zaslavsky (ernest.zaslavsky_at_[hidden])
Date: 2015-11-23 23:47:51


Thanks Robert, will check both, however the second approach of deriving from base and adding handling it is not something simple that can be done as POC in a day or two. Will start with wrappers. Thanks again!

-----Original Message-----
From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Robert Ramey
Sent: Monday, November 23, 2015 11:41 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Extend boost binary serialization with varints encoding

On 11/23/15 11:21 AM, Ernest Zaslavsky wrote:
> Ok, I came up with quite ugly solution (see on coliru http://coliru.stacked-crooked.com/a/ba39b5a242e5c69b). but it works, however it is ugly in the way that it is up to user to apply encode/decode on members. Moreover it is the only way to encode value. I was aiming to something broader, for example, in array or vector the size is stored in archive, it is size_t and it occupies 64 bit, in case of small data chunks it is complete waste of storage. Is there a way to force all primitive types of choice to use my serialization instead of standard one? I mean is there a way to encode this aforementioned size_t in array serialization without rewriting its implementation?

I think you could make a much simpler more elegant solution using serialization wrappers - look in the documentation.

But the broader question requires more thought.

It sounds to me that you'd like to change how the archive class itself behaves. The way to do this is to derived from the archive class which has mostly what you want and override the handling of the types you're interested in.

If you make your override accept the base archive as a template parameter, you can make your override applicable to any existing archive. I believe that the documentation has examples on how to do that as well.

Robert Ramey

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net