Your program will have at least one I/O execution context, such as an asio::io_context object, asio::thread_pool object, or asio::system_context. This I/O execution context represents your program’s link to the operating system’s I/O services.
-> ret, where ret specifiers the return type. If trailing-return-type is not present, the return type is implied by the function return statements (or void if it doesn’t return any value)
This completion token that can be passed as a handler to an asynchronous operation:
asio::use_awaitable
asio::detached
asio::use_future
asio::use_awaitable
The use_awaitable_t class, with its value use_awaitable, is used to represent the currently executing coroutine. This completion token may be passed as a handler to an asynchronous operation. For example:
When used with co_await, the initiating function (async_read_some in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned.
asio::detached
The detached_t class is used to indicate that an asynchronous operation is detached. That is, there is no completion handler waiting for the operation’s result. A detached_t object may be passed as a handler to an asynchronous operation, typically using the special value asio::detached. For example:
my_socket.async_send(my_buffer, asio::detached);
asio::use_future
The use_future_t class is used to indicate that an asynchronous operation should return a std::future object. A use_future_t object may be passed as a handler to an asynchronous operation, typically using the special value asio::use_future. For example:
The initiating function (async_read_some in the above example) returns a future that will receive the result of the operation. If the operation completes with an error_code indicating failure, it is converted into a system_error and passed back to the caller via the future.
this_coro::executor
Awaitable object that returns the executor of the current coroutine.
The redirect_error token transformation recovers the option to use the error_code interface, but it suffers from the same drawbacks that make pure error codes unappealing in the synchronous case.
This package contains a precompiled binary version of the protocol buffer compiler (protoc). This binary is intended for users who want to use Protocol Buffers in languages other than C++ but do NOT want to compile protoc themselves.
简单说,是给 C++ 开发者之外的码农用的。
但是,If you intend to use the included well known types,我们还是需要下载后者的。毕竟前者中 .proto 原型混杂在了大量的头文件中,而这里的原型文件一目了然。
强调:安装 IDE 时不要变更默认路径!否则,使用 vcpkg 磨难重重,vcpkg issue#12488。我安装 Language English 就失败了,后面也就没尝试。
从 visual studio 2015 的“选项”跳转到的中文网站,选择英文语言包下载到的其实是中文语言包,需要更换到对应的英文网站下载才是正确的。仍旧需要使用默认安装路径!
网速要好,偶尔也需要翻墙。如果使用系统自带的 powershell 碰到下载失败、下载慢,且版本陈旧。建议下载 powershell core 试一试,可能会有惊喜。 在 Windows 终端中设置代理 解决问题:$Env:https_proxy="http://127.0.0.1:10809"
使用 vcpkg 安装库后,如果较长时间未更新,再次更新时可能报错:
1 2 3 4 5 6
PS F:\vcpkg> .\vcpkg.exe update Using local portfile versions. To update the local portfiles, use `git pull`. Error: while loading boost-signals: The port directory (F:\vcpkg\ports\boost-signals) does not exist Error: failed to load port from F:\vcpkg\ports\boost-signals Note: Updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.
此时按照提示重新执行多次 bootstrap-vcpkg 也是无效的,我们需要清理掉过时的库:
1 2 3 4 5 6 7 8
PS F:\vcpkg> .\vcpkg.exe list boost-signals boost-signals2:x86-windows-static-md 1.71.0 Boost signals2 module boost-signals:x86-windows 1.68.0 Boost signals module PS F:\vcpkg> .\vcpkg.exe remove boost-signals:x86-windows The following packages will be removed: boost-signals:x86-windows Removing package boost-signals:x86-windows... Removing package boost-signals:x86-windows... done
之后就使用正常了:
1 2 3 4 5 6 7 8
PS F:\vcpkg> .\vcpkg.exe update Using local portfile versions. To update the local portfiles, use `git pull`. The following packages differ from their port versions: abseil:x86-windows 2020-03-03-4 -> 2020-09-23#3 abseil:x86-windows-static-md 2020-03-03-4 -> 2020-09-23#3 asio:x86-windows 1.12.2 -> 1.18.0 asio:x86-windows-static-md 1.12.2-2 -> 1.18.0 boost-accumulators:x86-windows-static-md 1.71.0 -> 1.75.0
受控字符序列(The controlled character sequence),也称作 buffer,可包括:input sequence (also called get area) 用于缓冲输入操作;以及 output sequence (also called put area) 用于缓冲输出操作。
关联字符序列,又称作源(对于输入)或池(对于输出)。它可以是通过 OS API 访问的实体(文件、 TCP 接头、串行端口、其他字符设备),或者可以是能转译成字符源或池的对象( std::vector 、数组、字符串字面量)