Stack.hpp
Vá para a documentação deste arquivo.
1 
6 #ifndef PERSISTENCE_STACK_HPP_
7 #define PERSISTENCE_STACK_HPP_
8 
9 namespace persistence {
10 
11 namespace stack {
12 
16 template<class T> class Node {
17 public:
20  T val;
26 
30  const int depth;
31 
38 
43  Node* K_Ancestor(int k);
44 
58  int ptr_ct;
59 
60  Node(const T& x, Node *nx);
61  Node(const Node&) = delete;
62  Node& operator=(const Node&) = delete;
63 };
64 
95 template<class T> class Stack {
96 public:
102 
106  Stack();
107 
110 
126  const T& Top() const;
127 
143  const T& K_th(int k) const;
144 
148  int Size() const;
149 
150 
152 
157 
163  Stack<T> Push(const T& x) const;
164 
169  Stack<T> Pop() const;
170 
172 
173  ~Stack();
174 
175  Stack& operator=(const Stack &o);
176  Stack(const Stack &o);
177 private:
178  Stack(Node<T> *u);
179 };
180 
181 } // namespace stack
182 
183 } // namespace persistence
184 
185 #include "Stack.tpp"
186 
187 #endif // PERSISTENCE_STACK_HPP_
int ptr_ct
Número de pointeiros para o nó.
Definition: Stack.hpp:58
Node< T > * node
Topo da pilha.
Definition: Stack.hpp:101
Nó da pilha persistente.
Definition: Stack.hpp:16
T val
Valor do nó.
Definition: Stack.hpp:20
int Size() const
Tamanho da pilha.
Stack()
Construtor de pilha vazia.
Stack< T > Push(const T &x) const
Inserção da valor.
Node * K_Ancestor(int k)
k-ésimo ancestral.
Node * next
Próximo nó.
Definition: Stack.hpp:25
Pilha persistente.
Definition: Stack.hpp:95
const int depth
Profundidade do nó.
Definition: Stack.hpp:30
Stack< T > Pop() const
Remoção do topo.
const T & Top() const
Topo da pilha.
const T & K_th(int k) const
k-ésimo elemento.
Node * jmp
Nó de pulo.
Definition: Stack.hpp:37