Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
The boilerplate is all done, and now we need to implement the function call operator that turns this composed operation a completion handler with the signature `void(error_code, std::size_t)` which is exactly the signature needed when performing asynchronous reads. This function is a transformation of the synchronous version of `detect_ssl` above, but with the inversion of flow that characterizes code written in the callback style:样板代码已经全部完成,接下来需要实现函数调用运算符,使该组合操作成为一个具有 `void(error_code, std::size_t)` 签名的完成处理器,而这正是执行异步读取时所需的签名。该函数是对上述同步版本 `detect_ssl` 的一种转换,但与同步版本不同,它采用了回调风格代码特有的控制流反转方式: