use crate::num::basic::unsigneds::PrimitiveUnsigned;
use crate::unsigned_vector::{ShortlexUnsignedVector, ShortlexUnsignedVectorRef};
use core::cmp::Ordering;
impl<T: PrimitiveUnsigned> Ord for ShortlexUnsignedVectorRef<'_, T> {
#[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<T: PrimitiveUnsigned> PartialOrd for ShortlexUnsignedVectorRef<'_, T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl<T: PrimitiveUnsigned> Ord for ShortlexUnsignedVector<T> {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
self.as_ref().cmp(&other.as_ref())
}
}
impl<T: PrimitiveUnsigned> PartialOrd for ShortlexUnsignedVector<T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}