For each function, I get/have a finite sized array of floats that I need to pick.
So if I have something like
1)
{-0.02, 0.5, 0.98, -0.15, etc... }
I would pick “-0.02” from this list.
2)
{-0.78, 0.003, 0.1, -1.8, etc... }
and now, I would pick “0.003” from this list.
This is just an example. In my real program, I have floats with 5-6 decimal points.
std::min_elementhas an overload that takes a comparison function object; that’s what I’d use here: