Boost logo

Boost Users :

Subject: [Boost-users] ASIO vs Beast DynamicBuffer use
From: Cristian Morales Vega (cristian_at_[hidden])
Date: 2018-11-01 14:25:47


Hi,

I have just noticed that while ASIO passes DynamicBuffers as &&
(https://www.boost.org/doc/libs/1_68_0/doc/html/boost_asio/reference/async_read_until/overload2.html)
Beast passes them via reference
(https://www.boost.org/doc/libs/1_68_0/libs/beast/doc/html/beast/ref/boost__beast__websocket__stream/async_read.html).

I'm guessing this happens because ASIO thinks you are going to use
dynamic_string_buffer/dynamic_vector_buffer as DynamicBuffer, while
Beast thinks you are going to use flat_buffer/multi_buffer. In the
second case doesn't make sense to give ownership of the DynamicBuffer
to the initiation function because then you would not be able to look
at the received data when the operation completes. Since ASIO
DynamicBuffer implementations are just adaptors over string/vectors
that you keep, it makes sense to move those adaptors, you still keep
the string/vector with the data. Have I got it right?

But this raises the question: what should I use in my own initiating functions?

Regards.


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