1
Fork 0

libcore: use unboxed closures in SlicePrelude methods

This commit is contained in:
Jorge Aparicio 2014-12-05 02:04:33 -05:00
parent 6ae9b9e54a
commit e2a362f9bb

View file

@ -238,7 +238,7 @@ pub trait SlicePrelude<T> for Sized? {
/// assert!(match r { Found(1...4) => true, _ => false, });
/// ```
#[unstable = "waiting on unboxed closures"]
fn binary_search(&self, f: |&T| -> Ordering) -> BinarySearchResult;
fn binary_search<F>(&self, f: F) -> BinarySearchResult where F: FnMut(&T) -> Ordering;
/// Return the number of elements in the slice
///
@ -552,7 +552,7 @@ impl<T> SlicePrelude<T> for [T] {
}
#[unstable]
fn binary_search(&self, f: |&T| -> Ordering) -> BinarySearchResult {
fn binary_search<F>(&self, mut f: F) -> BinarySearchResult where F: FnMut(&T) -> Ordering {
let mut base : uint = 0;
let mut lim : uint = self.len();