Repeated std::move on an boost::asio socket object in C++11

前端 未结 2 1625
深忆病人
深忆病人 2020-12-03 04:44

I am exploring using boost::asio along with C++11 features. In particular, I am focusing on an example called \"async_tcp_echo_server.cpp\", located here (code is also shown

2条回答
  •  旧时难觅i
    2020-12-03 05:15

    As documented in tcp::socket reference:

    Following the move, the moved-from object is in the same state as if constructed using the basic_stream_socket(io_service&) constructor.

    The above means that you can move the original socket object from server to session as many times as you need.

提交回复
热议问题