2013-04-15 51 views
0

我想要做這樣的事情(僞代碼)採用英特爾TBB的庫:如何在Intel TBB的parallel_for循環中指定循環步驟?

some function(int index, Mat data, vector<int> other) { 

} 

int start = 0 
int end = 100 
int step = 5 

parallel_for(start, end, step, some function) 

但是我不知道如何將額外的參數傳遞到「某些功能」。我應該怎麼做才能將我的附加數據傳遞給並行化函數,而不使它們變爲靜態/全局?我知道你可以使用C++的lambda函數做到這一點,但由於某些情況(與其他庫衝突),我無法使用它。

除此之外,我知道,我們可以使用範圍來指定循環範圍,但是,有什麼辦法,我可以設置的範圍之內環路一步?

我想提前感謝你!

+2

使用[算符](http://stackoverflow.com/a/356993/1762344)或['的std :: bind'](http://en.cppreference.com/w/cpp/utility/functional/結合) –

回答