Boost logo

Boost :

Subject: Re: [boost] Should pass boost::asio::io_service by raw pointer or smart pointer?
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-12-20 04:14:28

On Wed, Dec 19, 2018 at 4:30 PM hh h via Boost <boost_at_[hidden]> wrote:
> 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:



Boost list run by bdawes at, gregod at, cpdaniel at, john at