given a container like std::vector<T>
, where T
is a generic type for numerical quantities ( like int
, float
, etc ... ), I would like to have a predicate that takes as arguments :
- the container itself
- a range, a type expressing a numerical set of values, or simply 2 extreme numerical values, that should verify the predicate
- a tolerance, a type expressing a possible ( optional ) extension to the range, in relative terms ( like a percentage ) or in absolute terms ( with a numeric )
I would like to have as an output:
- the result of the predicate
- if the range is not enough for some quantities so the tolerance is "used" by some values or not ( but the predicate is still
true
)
In the C++ standard library looks like there is not even the concept of range
and this is strange to me, simply because there are a lot of interesting algorithms and types, but nothing that could possibly serve my purposes in this case.
Before continuing on my own path, I ask, there is something like this in terms of types and algorithms in the C++ library ?