Class and std::async on class member in C++

后端 未结 2 1291
感情败类
感情败类 2021-02-03 22:19

I\'m try to write a class member which calls another class member multiple times in parallel.

I wrote a simple example of the problem and can\'t even get to compile this

2条回答
  •  无人及你
    2021-02-03 22:21

    You can pass the this pointer to a new thread:

    async([this]()
    {
        Function(this);
    });
    

提交回复
热议问题