RcComparator

This commit is contained in:
AF 2023-06-16 05:57:11 +00:00
parent 344831dc91
commit a1db73920b

View File

@ -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)
}
}
}