26 Dec
2018
26 Dec
'18
5:20 a.m.
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.