已弃用的 get_io_service() 的替代方法

Vic*_*nko 6 boost-asio

Asio v 1.11。该文档说basic_stream_socket::get_io_service()成员函数已被弃用,get_executor()必须改用。但后者executor不返回io_service

如何获取对io_servicesocket使用的对象的引用来构造另一个?

m.s*_*.s. 5

您可以使用get_executor().context()

socket newSocket(existingSocket.get_executor().context()));
Run Code Online (Sandbox Code Playgroud)