chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.72k stars 1.19k forks source link

require allocator_t #1492

Open klemens-morgenstern opened 2 weeks ago

klemens-morgenstern commented 2 weeks ago

Hi Chris,

why does a post() not use the executor's allocator when it has no associated one?

  net::io_context ctx;

  auto exec = net::require(ctx.get_executor(), net::execution::allocator(my_alloc));
  exec.execute([]{}); // uses my_alloc
  net::post(exec, []{}); // uses std::allocator

I am just interested in the reasoning behind this, is it backwards compatibility for post?