Hi,
As I'm looking to modernize an older C++03 project based on Boost.Asio to use C++17 and the net TS api, I am not ready yet to give up on using lambdas for completion handlers.
Boost.Asio and Boost.Beast have some utilities for correctly implementing asynchronous composed operations but from them only asio::bind_executor seems to be applicable to lambdas. And the problem is that it only associates an executor with a (lambda) object; I didn't find any utility for associating an allocator too.
Could there be any reason for a utility that associates both an executor and an allocator with an object to not work correctly when implementing asynchronous operations? Or is it just that this utility has not been implemented yet?
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.
I would be very happy if I could write something like:
asio::post(
socket_.get_executor(),
bind_executor_and_allocator_from(
handler_,
[...] { self_.handler_(...); }));
and, unless I'm missing something, such a utility could be implemented similarly to the existing asio::bind_executor.
Thank you,
Sorin