boost::asio::ip::tcp::socket& socket() const
正在返回_socket
的类型boost::asio::ip::tcp::socket
是给我这个错误
error: invalid initialization of non-const reference of type ‘boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&’ from a temporary of type ‘const boost::reference_wrapper<const boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >’
socket()
函数只是getter,并没有改变这个对象的状态,所以如果我做了它为什么会触发错误const
?