Boost logo

Boost :

Subject: [boost] Does async_accept only access connection object raw pointer and wrapped it by shared pointer internally?
From: hh h (jupiter.hce_at_[hidden])
Date: 2018-12-26 05:20:55


I don't like to use raw pointer by new and delete, but the following
code will be crashed by double delete, can't async_accept accept
shared pointer?

std::shared_ptr<session> new_session =
std::make_shared<session>(io_service_, context_);
acceptor_.async_accept(new_session->socket(),
boost::bind(&server::handle_accept, this, new_session.get(),
boost::asio::placeholders::error));

Thank you.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk