Boost logo

Boost :

Subject: Re: [boost] [beast] A Networking-TS version of Boost.Asio and Boost.Beast is here!
From: paul (pfultz2_at_[hidden])
Date: 2017-10-04 14:51:49


On Wed, 2017-10-04 at 06:39 -0700, Vinnie Falco via Boost wrote:
> On Tue, Oct 3, 2017 at 2:23 PM, paul <pfultz2_at_[hidden]> wrote:
> >
> > How do the Buffer concepts change to depend on networking? The way the
> > buffers
> > are defined now, there is no dependency on Boost.Asio.
> Are you suggesting that the Net-TS buffer concepts do not depend on
> Boost.Asio? That's not entirely correct.
>
> Net-TS buffer sequence iterator value types must be convertible to
> `std::experimental::net::const_buffer` or
> `std::experimental::net::mutable_buffer`. In the Net-TS compatible
> version of Asio these types are  `boost::asio::const_buffer` and
> `boost::asio::mutable_buffer`.

I see, that requirement comes from here: http://www.boost.org/doc/libs/1_65_1/
doc/html/boost_asio/reference/ConvertibleToConstBuffer.html

>
> There is simply no way to avoid the dependency on these concrete types
> in Asio. In my other post I am proposing a library Boost.Buffers to
> work around this problem, so that people (like me) can write libraries
> which use only Asio buffer concepts, without a dependency on all of
> Asio (and everything that Asio depends on, recursively).

Ideally, the constructor to `buffer` or `const_buffer` should take any class
that has a `.data()` and `.size()` member. This way `value_type` can fulfill
the requirement of `ConvertibleToBuffer` without needing the dependency on a
concrete type.

Another option, is just moving these concrete buffer classes from Asio to your
new library, and then Boost.Asio will depend on Boost.Buffers.

.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk