Template Function mrpt::containers::find_closest_with_tolerance
Defined in File find_closest.h
Function Documentation
-
template<typename Container>
std::optional<std::pair<typename Container::key_type, typename Container::mapped_type>> mrpt::containers::find_closest_with_tolerance(const Container &data, const typename Container::key_type x, const typename Container::key_type tolerance) For an associate container
Containermapping real number keys toTvalues, searchs for the closest key within a given tolerance, that is, the key closest toxwithin the interval [x-tolerace, x+tolerance]. An emptystd::optionalis returned if none is found.Computational cost:
O(log(N)+M)withNthe total size of the container,Mthe worst-case number of items in any interval of width2*tolerance.See also
Note
(New in MRPT 2.5.0)