Basically I want to find the smallest (positive) value from a group of values and to compare with the first default value. A naive assumption would be, they would always compare “less” (except for NaNs, but not consider them), but I'm not quite sure.
I use type float, and I think it can be safely assumed that my target equipment implements the value of infinity.
Here is a sample code:
auto leastValue = std::numeric_limits<float>::infinity();
for (auto i = something.begin(), e = something.end(); i != e; ++i)
{
auto value = (*i)->GetValue();
if (value < leastValue)
{
leastValue = value;
}
}
source
share