Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio/Beast] Any non-obvious reasons for no bind_executor_and_allocator?
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-12-20 00:57:15


On Wed, Dec 19, 2018 at 4:31 PM Sorin Fetche via Boost-users
<boost-users_at_[hidden]> wrote:
> I did come across the paper "Networking TS Associations for Call Wrappers"[1]
> but I didn't see any mention there about bind_executor or something similar for
> allocators or why this kind of approach wouldn't work.

Eh... you have `socket_` which means you have a class, so there is
really no reason not to use the intrusive mechanism for associating
your class with the executor and allocator associated with `handler_`.
This is covered in the Beast composed operation tutorial:

<https://www.boost.org/doc/libs/1_69_0/libs/beast/doc/html/beast/using_io/writing_composed_operations.html>

When I want to use my own allocator, I usually just add a "wrap"
member to the allocator which performs the association:

<https://github.com/boostorg/beast/blob/c4813a5ac79d802951cf70b811ded94ce7ef7d79/example/common/session_alloc.hpp#L281>

The need for a specific, dedicated function to perform the allocator
association has just never come up in practical code. I think this is
why Asio / Net.TS doesn't provide it.

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