Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
The type of the function's return value is determined by the函数返回值类型由 [@boost:/doc/html/boost_asio/reference/async_result.html `net::async_result`]customization point, which comes with specializations for common library types such as `std::future` and may also be specialized for user-defined types. The body of the initiating function calls the [@boost:/doc/html/boost_asio/reference/async_initiate.html `net::async_initiate`] helper to capture the arguments and forward them to the specialization of `async_result`. An additional "initiation function" object is provided which `async_result` may use to immediately launch the operation, or defer the launch of the operation until some point in the future (this is called "lazy execution"). The initiation function object receives the internal completion handler which matches the signature expected by the initiating function:定制点决定。该定制点为 `std::future` 等常用库类型提供特化版本,同时也支持用户自定义类型的特化。发起函数的函数体通过调用 [@boost:/doc/html/boost_asio/reference/async_initiate.html `net::async_initiate`] 辅助函数来捕获参数并将其转发给 `async_result` 的特化版本。此外,还提供一个额外的“发起函数”对象,`async_result` 可利用该对象立即启动操作,或将操作启动延迟到未来某个时刻(即“延迟执行”)。该发起函数对象接收一个内部完成处理器,其签名与发起函数所期望的签名相匹配。