diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-04-10 13:14:06 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-04-10 17:32:03 -0700 |
| commit | 03396473b879b37d68f26588d136c840280b0ab5 (patch) | |
| tree | 1fb55f17735fcfb9b8770bcf15ba657302680d53 /src/libstd/priority_queue.rs | |
| parent | 61b9e0ebfa7c96886c45a461c6d8edb22f8153da (diff) | |
| download | rust-03396473b879b37d68f26588d136c840280b0ab5.tar.gz rust-03396473b879b37d68f26588d136c840280b0ab5.zip | |
libstd: changes to in response to #5656
Diffstat (limited to 'src/libstd/priority_queue.rs')
| -rw-r--r-- | src/libstd/priority_queue.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index dd56e413595..c8d250f90f6 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -50,13 +50,29 @@ impl<T:Ord> Mutable for PriorityQueue<T> { pub impl <T:Ord> PriorityQueue<T> { /// Returns the greatest item in the queue - fails if empty + #[cfg(stage0)] fn top(&self) -> &'self T { &self.data[0] } + /// Returns the greatest item in the queue - fails if empty + #[cfg(stage1)] + #[cfg(stage2)] + #[cfg(stage3)] + fn top<'a>(&'a self) -> &'a T { &self.data[0] } + /// Returns the greatest item in the queue - None if empty + #[cfg(stage0)] fn maybe_top(&self) -> Option<&'self T> { if self.is_empty() { None } else { Some(self.top()) } } + /// Returns the greatest item in the queue - None if empty + #[cfg(stage1)] + #[cfg(stage2)] + #[cfg(stage3)] + fn maybe_top<'a>(&'a self) -> Option<&'a T> { + if self.is_empty() { None } else { Some(self.top()) } + } + /// Returns the number of elements the queue can hold without reallocating fn capacity(&self) -> uint { vec::capacity(&self.data) } |
