这就是我们使用std :: function的方式。
std::function<void(int)> f_display = print_num;
以下确切说明的含义是什么???
有人会提供示例或解释如何使用此代码段..
using genericPointAction = std::function<void (const CCVector3 &, ScalarType &)>;
void forEach(GenericCloud::genericPointAction action) override
{
//there's no point of calling forEach if there's no activated scalar field!
ScalarField* currentOutScalarFieldArray = getCurrentOutScalarField();
if (!currentOutScalarFieldArray)
{
assert(false);
return;
}
unsigned n = size();
for (unsigned i = 0; i < n; ++i)
{
action(m_points[i], (*currentOutScalarFieldArray)[i]);
}
}