use crate::natural_vector::{ShortlexNaturalVector, ShortlexNaturalVectorRef};
use core::cmp::Ordering;
impl Ord for ShortlexNaturalVectorRef<'_> {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
self.0
.elements
.len()
.cmp(&other.0.elements.len())
.then_with(|| self.0.elements.cmp(&other.0.elements))
}
}
impl PartialOrd for ShortlexNaturalVectorRef<'_> {
#[inline]
fn partial_cmp(&self, other: &ShortlexNaturalVectorRef) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for ShortlexNaturalVector {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
self.as_ref().cmp(&other.as_ref())
}
}
impl PartialOrd for ShortlexNaturalVector {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}