diff options
Diffstat (limited to 'src/libstd/vec.rs')
| -rw-r--r-- | src/libstd/vec.rs | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 211ee12c291..7b4764164b5 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -118,15 +118,6 @@ pub fn capacity<T>(v: &const ~[T]) -> uint { } } -// A botch to tide us over until core and std are fully demuted. -#[allow(missing_doc)] -pub fn uniq_len<T>(v: &const ~[T]) -> uint { - unsafe { - let v: &~[T] = transmute(v); - as_const_buf(*v, |_p, len| len) - } -} - /** * Creates and initializes an owned vector. * @@ -1767,19 +1758,32 @@ pub mod traits { } } -impl<'self,T> Container for &'self const [T] { +impl<'self, T> Container for &'self const [T] { /// Returns true if a vector contains no elements #[inline] - fn is_empty(&const self) -> bool { + fn is_empty(&self) -> bool { as_const_buf(*self, |_p, len| len == 0u) } /// Returns the length of a vector #[inline] - fn len(&const self) -> uint { + fn len(&self) -> uint { as_const_buf(*self, |_p, len| len) } +} + +impl<T> Container for ~[T] { + /// Returns true if a vector contains no elements + #[inline] + fn is_empty(&self) -> bool { + as_const_buf(*self, |_p, len| len == 0u) + } + /// Returns the length of a vector + #[inline] + fn len(&self) -> uint { + as_const_buf(*self, |_p, len| len) + } } #[allow(missing_doc)] @@ -2615,23 +2619,6 @@ impl<A:Copy> old_iter::CopyableIter<A> for @[A] { } } -impl<'self,A:Copy + Ord> old_iter::CopyableOrderedIter<A> for &'self [A] { - fn min(&self) -> A { old_iter::min(self) } - fn max(&self) -> A { old_iter::max(self) } -} - -// FIXME(#4148): This should be redundant -impl<A:Copy + Ord> old_iter::CopyableOrderedIter<A> for ~[A] { - fn min(&self) -> A { old_iter::min(self) } - fn max(&self) -> A { old_iter::max(self) } -} - -// FIXME(#4148): This should be redundant -impl<A:Copy + Ord> old_iter::CopyableOrderedIter<A> for @[A] { - fn min(&self) -> A { old_iter::min(self) } - fn max(&self) -> A { old_iter::max(self) } -} - impl<A:Clone> Clone for ~[A] { #[inline] fn clone(&self) -> ~[A] { |
