-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStack_Iterator.h
65 lines (53 loc) · 1.25 KB
/
Stack_Iterator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Honor Pledge:
//
// I pledge that I have neither given nor
// received any help on this assignment.
//
// blakbenn
#ifndef _STACK_ITERATOR_H_
#define _STACK_ITERATOR_H_
#include <cstring> // for size_t definition
#include "Stack.h"
/**
* @class Stack_Iterator
*
* Implementation of the Iterator Pattern
*/
template <typename T>
class Stack_Iterator {
public:
typedef T type;
/// Default constructor, requires a Stack<T> s
Stack_Iterator (Stack <T> & s);
///Default destructor
~Stack_Iterator (void);
/**
* is_done function, checks to see if the iterator is finished
*
* @return boolean value
*/
bool is_done (void);
/**
* advance function, decrements our stack iterator, pops the stack
*
* @return boolean value
*/
void advance (void);
/**
* overloaded * operator
*
* @return variable of type T
*/
T operator * (void);
/**
* overloaded -> operator
*
* @return *T pointer to a variable of type T
*/
T * operator -> (void);
private:
Stack <T> & s_;
size_t curr_;
};
#include "Stack_Iterator.cpp" //include for template class
#endif // !defined _STACK_ITERATOR_H_