combining similar functions into one common function involving passing function pointers as parameters
<p>I am trying to combine the following two functions into one portable function:</p>

<pre><code>void NeedleUSsim::FindIdxRho()
{
    searchTmp = &amp;ninfo-&gt;rho;
    double *p = std::find_if(tplRho_deg, tplRho_deg+sampleDim[2], &amp;NeedleUSsim::GreaterThanOrEqualTo);
    while(p != tplRho_deg+sampleDim[2])
    {
     idxRho = p - tplRho_deg;
     p = std::find_if(p+1, tplRho_deg+sampleDim[2], &amp;NeedleUSsim::GreaterThanOrEqualTo);
    }
}

void NeedleUSsim::FindIdxDepth()
{
    searchTmp = &amp;ninfo-&gt;l;
    double *p = std::find_if(tplL, tplL+sampleDim[1], &amp;NeedleUSsim::LessThanOrEqualTo);
    while(p != tplL+sampleDim[1])
    {
     idxL = p - tplL;
     p = std::find_if(p+1, tplL+sampleDim[1], &amp;NeedleUSsim::LessThanOrEqualTo);
    }
}
</code></pre>

<p>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 &amp;NeedleUSsim::GreaterThanOrEqualTo function as a parameter of the function that I'm trying to write easily?</p>

<p>Thanks in advance for the advice.</p>
