On 4 Feb 2015 at 21:46, Thomas Heller wrote:
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?
Firstly AFIO does file i/o, not network i/o. You'd use ASIO for
network i/o.
If the user feeds std::list<int>(1000) to AFIO write(), I don't think
you get a choice here: a gather write of 1000 individual items is
requested and that is what is issued.
If the user feeds std::vector<int>(1000) to AFIO write(), there is
already a specialisation of to_asio_buffers() for vector, array,
string and C arrays which recognises the fact they guarantee
contiguous storage of their contents. In that situation AFIO issues a
single gather buffer for the entire contents at once.
If the user feeds std::vector