0

I need to compile a bind function in a Posix embedded, and can't use boost::bind or std::bind.

So I want to split the function: threadReducer.reduce(boost::bind(&DepthMap::observeDepthRow, this, _1, _2, _3), 3, height-3, 10);

where the function observeDepthRow:
void DepthMap::observeDepthRow(int yMin, int yMax, RunningStats* stats)
and the function reduce:
void IndexThread::reduce(boost::function<void(int,int,RunningStats*)> callPerIndex, int first, int end, int stepSize = 0)

Plz, help me split the function, I am not good at C++

nistar
  • 13
  • 6

1 Answers1

0

If you cannot use boost or c++11 .. in that in that case you may try like this :

void IndexThread::reduce(void(*function)(int,int,RunningStats*), int first, int end, int stepSize = 0)

and make your observeDepthRow static

static void DepthMap::observeDepthRow(int yMin, int yMax, RunningStats* stats)

Then you can call it like this :

threadReducer.reduce(observeDepthRow, 3, height-3, 10);

although in this case you will have to make your method static if you do not wish so do have look at this.

Community
  • 1
  • 1
Hummingbird
  • 647
  • 8
  • 27