mac 无法在 clion 中使用生成器和任务

Couldn't use generator and task in clion on mac

我有这样的代码:

generator<int> range(int start, int end) {
    while (start < end) {
        co_yield start;
        start++;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    for (auto n: range(0, 10)) {
        cout << n << ' ';
    }
}

编译时出现错误:

error: no template named 'generator'; did you mean 'iterator'?

我在任务中遇到了类似的错误。是不是c++20的支持有问题?如何修复?

如康桐蔚所说,还在proposal stage, the workaround is to use a third-party library such as cppcoro's generator implementation