PrevUpHomeNext

cobalt::awaitable @cpp


boost::cobalt::awaitable concept - cpp

cobalt::awaitable c++ concept

cobalt::awaitable 是一个 c++ concept,要求一个类型必须是一个 awaitable 类型,即可 co_await 表达式。

4月15日 - fayige.top

cobalt::awaitable c++ 代码例子

显然,cobalt::promise, cobalt::generator 都满足 cobalt::awaitable

c++ boost::cobalt::awaitable 例子

文件名:cobalt_awaitable.cpp

#include <boost/cobalt.hpp>
#include <iostream>

namespace cobalt = boost::cobalt;

template <cobalt::awaitable type_t>
class test
{
};

cobalt::main co_main(int argc, char * argv[])
{
	test<cobalt::promise<int>>{};
	test<cobalt::generator<float>>{};
	std::cout << "欢迎收看,谢谢!" << std::endl;
	co_return 0;
}

相关链接

boost::cobalt hello @cpp

boost::cobalt::race @cpp









首页:发一格 fayige.top









版权

Copyright 2024 fayige.top

Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)


PrevUpHomeNext