Template Function mrpt::containers::find_closest
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(const Container &data, const typename Container::key_type x) 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 empty
std::optionalis returned if none is found, i.e. if the container was empty.Computational cost:
O(log(N))withNthe total size of the container.See also
Note
(New in MRPT 2.5.0)