add a BaseIter implementation for PriorityQueue
This commit is contained in:
parent
6647a3402b
commit
d903231f1e
1 changed files with 9 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
|||
|
||||
use core::container::{Container, Mutable};
|
||||
use core::cmp::Ord;
|
||||
use core::iter::BaseIter;
|
||||
use core::prelude::*;
|
||||
use core::ptr::addr_of;
|
||||
use core::vec;
|
||||
|
@ -26,6 +27,14 @@ pub struct PriorityQueue<T> {
|
|||
priv data: ~[T],
|
||||
}
|
||||
|
||||
impl <T: Ord> PriorityQueue<T>: BaseIter<T> {
|
||||
/// Visit all values in the underlying vector.
|
||||
///
|
||||
/// The values are **not** visited in order.
|
||||
pure fn each(&self, f: fn(&T) -> bool) { self.data.each(f) }
|
||||
pure fn size_hint(&self) -> Option<uint> { self.data.size_hint() }
|
||||
}
|
||||
|
||||
impl <T: Ord> PriorityQueue<T>: Container {
|
||||
/// Returns the length of the queue
|
||||
pure fn len(&self) -> uint { self.data.len() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue