Imagine, I have a class MyClass and want to implement multi-threading with Intel TBB:
class MyClass
{
public:
tbb::flow::function_node<int, double>* _fnode;
private:
tbb::flow::graph* _graph;
double fbody(int inp);
}
Is it possible to initialize _fnode
with class-member function? Simple way does not work:
_fnode = new tbb::flow::function_node<int, double>(*_graph,1,MyClass::fbody)
Thank to Jonathan for his idea to use std::bind. So, the solution of this problem:
_fnode = new tbb::flow::function_node<int, double>(*_graph,1,std::bind(&MyClass::fbody, this, std::placeholders::_1));