I want to use a library (https://github.com/onlinecity/cpp-smpp) and it's based on boost 1.41. But in our project, we are using 1.72.
There is a code there that gets io_service from a TCP socket (socket->get_io_service()here). Then this object is used in the following parts of the code:
deadline_timer timer(ioService);
and
ioService.run_one();
ioService.reset();
But get_io_service() is removed from boost 1.70+. What functions and objects I should use instead of those in such situations?
UPDATE
There is another question (Alternative to deprecated get_io_service()) that is similar to mine, but the answers in that question do not work in the scenario of this one.
Have a look at this commit: https://github.com/mavlink/mavros/commit/3da41d770ca0e021f597bef30ffe6fcefe3e6959
It defines a macro
#if BOOST_VERSION >= 107000
#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
#else
#define GET_IO_SERVICE(s) ((s).get_io_service())
#endif
and replaces the calls
socket.get_io_service()
with
GET_IO_SERVICE(socket)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With