Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
template<typename Value>
Value search_containing_interval(
std::vector<std::pair<double, Value>> const& intervals, double weight)
auto it = std::lower_bound(
intervals.begin(), intervals.end(), weight,
[](auto const& element, double weight)
return element.first < weight;
return it->second; //By construction, always exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment