如何拆分功能:绑定
how to split function: bind
我需要在嵌入的posix中编译 bind
函数,并且不能使用 boost::bind
或 std::bind
。
所以我想拆分功能: threadReducer.reduce(boost::bind(&DepthMap::observeDepthRow, this, _1, _2, _3), 3, height-3, 10);
函数观察到epthrow:
void DepthMap::observeDepthRow(int yMin, int yMax, RunningStats* stats)
功能降低:
void IndexThread::reduce(boost::function<void(int,int,RunningStats*)> callPerIndex, int first, int end, int stepSize = 0)
plz,帮助我拆分功能,我不擅长C
如果您不能使用Boost或C 11 ..在这种情况下,您可以尝试这样做:
void IndexThread::reduce(void(*function)(int,int,RunningStats*), int first, int end, int stepSize = 0)
使您的observeDepthRow static
static void DepthMap::observeDepthRow(int yMin, int yMax, RunningStats* stats)
然后您可以这样称呼:
threadReducer.reduce(observeDepthRow, 3, height-3, 10);
尽管在这种情况下,如果您不希望,则必须制作方法static
,因此请务必查看。
相关文章:
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- 在基于范围的for循环中使用结构化绑定声明
- 使用提升功能与地图绑定提升
- 绑定和提升功能
- C++ 由于无法解决过载功能而导致绑定失败
- C 使用多个lambdas/绑定以引用相同的功能
- 实现功能对象绑定而无需使用C 11
- 尝试将简单按钮绑定到SFGUI中的OnClick功能
- 绑定std ::功能错误
- rvalue参考绑定到std ::功能类型的LVALUE
- 如何拆分功能:绑定
- 转换std ::绑定到功能指针
- C 快速绑定成员功能的方法
- 如何绑定变异模板参数与功能
- STD ::绑定和超载功能
- 试图了解动态绑定和虚拟功能
- 消除对Boost ::的需求,以绑定我的功能
- C 预处理器中的功能绑定操作
- 虚拟功能和助推绑定奇怪的行为
- XML数据绑定-可以自动完成读/写功能