From 1737a24e0dbdbd6b22aa6c1db9f093605c325f95 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Thu, 10 Sep 2015 13:51:47 +0100 Subject: [PATCH] Add `PartialOrd` and `Ord` implementation for `ArrayVec` --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index bb42697..d1f75f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ extern crate odds; extern crate nodrop; +use std::cmp; use std::iter; use std::mem; use std::ptr; @@ -642,3 +643,15 @@ impl Default for ArrayVec { ArrayVec::new() } } + +impl PartialOrd for ArrayVec where A::Item: PartialOrd { + fn partial_cmp(&self, other: &ArrayVec) -> Option { + (**self).partial_cmp(other) + } +} + +impl Ord for ArrayVec where A::Item: Ord { + fn cmp(&self, other: &ArrayVec) -> cmp::Ordering { + (**self).cmp(other) + } +}