diff options
| author | bors <bors@rust-lang.org> | 2013-04-12 15:14:24 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-12 15:14:24 -0700 |
| commit | 76f6606a8cca62baf89163d5091af5e594dafd20 (patch) | |
| tree | 9ea72645e98888bf5e1e4cf58e4055c7c5c57a2c /src/libstd/priority_queue.rs | |
| parent | 5bb2e8f62c5666f61db0b670f80f64ca673d22d6 (diff) | |
| parent | c97c03cd6a5c4ac37f2e68226c9f8ec49c786fcf (diff) | |
| download | rust-76f6606a8cca62baf89163d5091af5e594dafd20.tar.gz rust-76f6606a8cca62baf89163d5091af5e594dafd20.zip | |
auto merge of #5827 : nikomatsakis/rust/issue-5656-change-meaning-of-borrowed-self, r=pcwalton
See #5656 for details. r? @pcwalton
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) } |
