20 Dec
2018
20 Dec
'18
4:14 a.m.
On Wed, Dec 19, 2018 at 4:30 PM hh h via Boost
In many examples and even implementations, programmers like to pass boost::asio::io_service by raw pointer:
Those examples are wrong. `io_context` should be passed by reference.
Will this cause issues to pass raw pointer for large size of classes, should it be replaced by passing smart pointer:
A smart pointer is less efficient than a pointer, all else equal. But you shouldn't be using any form of pointer, the io_context (legacy name: io_service) is passed by reference. All of the Beast and Asio examples demonstrate this: https://github.com/boostorg/beast/tree/develop/example https://github.com/boostorg/asio/tree/develop/example Regards