| 6 | import optimum; |
| 7 | |
| 8 | std::optional<double> Finder::findNearest(const std::vector<double>& values) const |
| 9 | { |
| 10 | if (values.empty()) |
| 11 | return std::nullopt; |
| 12 | else |
| 13 | return *findOptimum(values, [this](double x, double y) { |
| 14 | return std::abs(x - m_number_to_search_for) < std::abs(y - m_number_to_search_for); |
| 15 | }); |
| 16 | } |
| 17 | |
| 18 | double Finder::getNumberToSearchFor() const |
| 19 | { |
no test coverage detected