开发者

Boost. Multithreading

开发者 https://www.devze.com 2023-02-06 20:33 出处:网络
class accel{ public: accel(int threads, string params); private: void getfile(int from, int to); void download(int threads);
class accel{
public:
    accel(int threads, string params);

private:
    void getfile(int from, int to);
    void download(int threads);
};


void accel::download(int threads){
    boost::thread g(&getfile(0, 1));  //<<<<
}

Gives an error '&' requires l-value. I开发者_如何学Python have been doing this by example. How to make it work?


boost::thread g (boost::bind(&accel::getfile, this, 0, 1));


getfile returns void- you are trying to take the address of a variable of type void. That doesn't make any sense at all. You will have to use a bound function object- check out boost::bind.

0

精彩评论

暂无评论...
验证码 换一张
取 消