Add Zero impls for lots of common types
This commit is contained in:
parent
07f5ab1009
commit
893c70d7bc
6 changed files with 63 additions and 2 deletions
|
@ -23,6 +23,7 @@ use iterator::{Iterator, IteratorUtil};
|
|||
use iter::FromIter;
|
||||
use kinds::Copy;
|
||||
use libc;
|
||||
use num::Zero;
|
||||
use old_iter::CopyableIter;
|
||||
use option::{None, Option, Some};
|
||||
use ptr::to_unsafe_ptr;
|
||||
|
@ -2702,6 +2703,16 @@ impl<A:Clone> Clone for ~[A] {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A> Zero for ~[A] {
|
||||
fn zero() -> ~[A] { ~[] }
|
||||
fn is_zero(&self) -> bool { self.len() == 0 }
|
||||
}
|
||||
|
||||
impl<A> Zero for @[A] {
|
||||
fn zero() -> @[A] { @[] }
|
||||
fn is_zero(&self) -> bool { self.len() == 0 }
|
||||
}
|
||||
|
||||
macro_rules! iterator {
|
||||
/* FIXME: #4375 Cannot attach documentation/attributes to a macro generated struct.
|
||||
(struct $name:ident -> $ptr:ty, $elem:ty) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue