RcComparator
This commit is contained in:
parent
344831dc91
commit
a1db73920b
@ -33,3 +33,16 @@ impl<A: PartialOrd> Comparator<A> for DefaultComparator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct RcComparator<C>(C);
|
||||||
|
|
||||||
|
mod rc_comparator_impl {
|
||||||
|
use super::*;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
impl<A, C: Comparator<A>> Comparator<Rc<A>> for RcComparator<C> {
|
||||||
|
fn pick_smaller(&self, kl: &Rc<A>, kr: &Rc<A>) -> Comparison {
|
||||||
|
self.0.pick_smaller(kl, kr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user