Shared_Ptr of socket creation - what is wrong?
问题 So I try: boost::shared_ptr<tcp::socket> socket = boost::make_shared<tcp::socket>(io_service); As described here. But It bring me an error: Compiler tells me that it can not turn ( error C2664: boost::asio::basic_stream_socket<Protocol>::basic_stream_socket( boost::asio::io_service &)) 'boost::asio::io_service *const ' into 'boost::asio::io_service &' \include\boost\smart_ptr\make_shared.hpp What shall I do? 回答1: You need to pass the io_service as a reference when using make_shared . boost: