I am trying to combine the following two functions into one portable function:
void NeedleUSsim::FindIdxRho()
{
searchTmp = &ninfo->rho;
double *p = std::find_if(tplRho_deg, tplRho_deg+sampleDim[2], &NeedleUSsim::GreaterThanOrEqualTo);
while(p != tplRho_deg+sampleDim[2])
{
idxRho = p - tplRho_deg;
p = std::find_if(p+1, tplRho_deg+sampleDim[2], &NeedleUSsim::GreaterThanOrEqualTo);
}
}
void NeedleUSsim::FindIdxDepth()
{
searchTmp = &ninfo->l;
double *p = std::find_if(tplL, tplL+sampleDim[1], &NeedleUSsim::LessThanOrEqualTo);
while(p != tplL+sampleDim[1])
{
idxL = p - tplL;
p = std::find_if(p+1, tplL+sampleDim[1], &NeedleUSsim::LessThanOrEqualTo);
}
}
Ideally, I want the parameters of the function to have tpl member to be passed as a pointer, with the size and rho/l passed as value. searchTmp is a file scope double precision pointer. Is there any easy way of passing &NeedleUSsim::GreaterThanOrEqualTo function as a parameter of the function that I'm trying to write easily?
Thanks in advance for the advice.