Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Nevin Liber (nevin_at_[hidden])
Date: 2015-01-23 14:26:17

Is the library ready to be added to Boost releases?


On 23 January 2015 at 11:47, Peter Dimov <lists_at_[hidden]> wrote:

Instead, in the function read(h), I do this (pseudocode):
> read( header& h )
> {
> unsigned char data[ 14 ];
> fread data from file;
> read_32_lsb( h.code, data + 0 );
> read_32_lsb( h.length, data + 4 );
> read_16_msb( h.version, data + 8 );
> read_32_lsb( h.shape_type, data + 10 );
> }

Basically you serialize it by hand.

Another more declarative (de)serialization technique is the one that Tom
Rodgers talked about at CppCon "Implementing Wire Protocols with Boost

Other than specifically calling out Boost.Serialization, this already seems
to be covered in the documentation:

*Why not just use Boost.Serialization?* Serialization involves a conversion
for every object involved in I/O. Endian integers require no conversion or
copying. They are already in the desired format for binary I/O. Thus they
can be read or written in bulk.

 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

Boost list run by bdawes at, gregod at, cpdaniel at, john at