开发者

Boost. Multithreading

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜