Skip to main content

binary_search_pos

Function binary_search_pos 

Source
pub fn binary_search_pos<T, V, F>(arr: &[T], val: &V, less: &F) -> usize
where F: Fn(&V, &T) -> bool,
Expand description

Binary search for the insertion position of val in a sorted slice. Returns the index where val would be inserted to maintain sort order.

Port of C++ binary_search_pos.