
On Wed, May 21, 2025 at 7:52 PM Klebsch, Mario via Boost-users <boost-users@lists.boost.org> wrote:
There is no default value of Executor, so how does the template instantiation of basic_stream_socket<tcp> compile?
The default executor is specified a few lines above in the forward declaration: template <typename Protocol, typename Executor = any_io_executor> class basic_stream_socket;
I cannot do socket.get_executor().context().post(…).
You don't need the context. You can write it like: asio::post(socket.get_executor(), []() {}); Asio has changed the default executor of io_object types from io_context::executor_type to any_io_executor, to make them easier to use and reduce code bloat as there is no need for generating special composed operations for each executor type. You can find that in the change log: https://www.boost.org/doc/libs/develop/doc/html/boost_asio/history.html#boos... You can still use a concrete executor type if you want. It will of course change the socket type: using my_socket_t = typename asio::ip::tcp::socket::rebind_executor<asio::io_context::executor_type>::other; You can also use any_io_executor and access the concrete executor when you know the underlying executor type: asio::any_io_executor executor{ io_context }; executor.target<asio::io_context::executor_type>().something...