added impl for radix sort need to debug
This commit is contained in:
parent
54a58c9b04
commit
38e4d68f4b
3 changed files with 65 additions and 3 deletions
|
|
@ -1,8 +1,9 @@
|
|||
#[derive(Debug)]
|
||||
pub struct Stack<T> {
|
||||
stack: Vec<T>,
|
||||
}
|
||||
|
||||
impl<T> Stack<T> {
|
||||
impl<T: Copy> Stack<T> {
|
||||
pub fn new() -> Self {
|
||||
Stack { stack: Vec::new() }
|
||||
}
|
||||
|
|
@ -22,3 +23,12 @@ impl<T> Stack<T> {
|
|||
self.stack.last()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Copy> IntoIterator for Stack<T> {
|
||||
type Item = T;
|
||||
type IntoIter = std::vec::IntoIter<Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.stack.into_iter()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue