Subject: Re: [boost] Serialisation: Is is_trivial<T> a sufficient precondition to bypass serialisation?
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2015-02-04 15:46:43
Am 04.02.2015 12:54 schrieb "Niall Douglas" <s_sourceforge_at_[hidden]>:
> A library user has raised an interesting question at:
> Basically, AFIO v1.3 has new pre-serialisation metaprogramming in
> response to Robert's comments on his Incubator about it being too
> hard to serialise and deserialise data with AFIO. AFIO will now
> consume any STL container and will implicitly auto expand to ASIO
> scatter gather buffers any:
> 1. Trivial type T
> 2. C array of trivial type T
> 3. STL container of trivial type T, including initializer_list.
So you generate a list of N scatter/gather buffers for a container with the
size of N? That sounds a tad too much. Doesn't that create a immense
overhead for the network interface?
> A free function, to_asio_buffers(T), can be specialised by external
> code to extend this with custom ASIO scatter gather buffers
> generation. Note that AFIO explicitly and intentionally expects that
> anyone interested in async file i/o will be doing their serialisation
> and endian conversion far away from AFIO code, so to_asio_buffers(T)
> is really for marking extra types to be treated as implicit auto
> The user asks the question: Is is_trivial<T> a sufficient
> precondition for this auto expansion to be safe, or should
> is_standard_layout<T> also be required? The user notes that
> is_trivial<T> && is_standard_layout<T> == is_pod<T> which seems a
> little overkill to me.
> There is also the possibility that is_trivial<T> is too conservative.
> Some may argue that is_trivially_copyable<T> would be sufficient.
> ned Productions Limited Consulting
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk