CppCoroutines icon indicating copy to clipboard operation
CppCoroutines copied to clipboard

Results 5 CppCoroutines issues
Sort by recently updated
recently updated
newest added

不然报错找不到std::exchange 我的GCC是12.1.1的

一. 在initial_suspend挂起点DispatchAwaiter 是eager start 如果在DispatchAwaiter分发到另一个线程启动会遇到问题 比如主线程创建{ Task task = CreateTask();} 又立即析构task, raii里h.destroy(), 此时task在另一个线程运行可能不处于suspend状态,就UB了。 二. 如果是这样 { Task task = CreateTask(); task.get_result();}也好像依然有问题 按照cppreference co_return按以下顺序 1. call promise.return_value(expr) 2. destroys all variables...

```cpp Generator generator = Generator::from(1, 2, 3, 4).map([](int i) { return i * 2; }); ``` 在这个例子中,由 from 生成的对象在对 generator 消费前已经析构掉了,导致后续出错 我有几个思路。 #### 1. 使用 c++23 的 deducing this. 把原map函数限定为左值引用,然后添加一个值传递的重载...

Task Producer(Channel &channel) 改成 Task Producer(Channel &channel) 去掉 co_await 10ms会core掉

``` [ 12%] Building CXX object CMakeFiles/03.functional.cpp.dir/03.functional.cpp.o In file included from /home/ubuntu/CppCoroutines/03.functional.cpp:5: /usr/include/c++/10/coroutine:295:2: error: #error "the coroutine header requires -fcoroutines" ``` 不知道为啥`cmake ..`之后调用`make`报错了。更改了一下`cmake_minimum_required`其他没改。g++是g++10 ``` cmake_minimum_required(VERSION 3.16) ``` 对cmake不是很懂希望大佬们别见怪。