ModErn Text Analysis
META Enumerates Textual Applications
persistent_stack.h
Go to the documentation of this file.
1 
10 #ifndef META_UTIL_PERSISTENT_STACK_H_
11 #define META_UTIL_PERSISTENT_STACK_H_
12 
13 #include <memory>
14 
15 namespace meta
16 {
17 namespace util
18 {
19 
20 template <class T>
22 {
23  public:
25 
26  persistent_stack<T> push(T data) const;
27 
28  persistent_stack<T> pop() const;
29 
30  const T& peek() const;
31 
32  uint64_t size() const;
33 
34  class exception : public std::runtime_error
35  {
36  public:
37  using std::runtime_error::runtime_error;
38  };
39 
40  private:
41  struct node
42  {
43  node(T item, std::shared_ptr<node> previous);
44 
45  T data;
46  std::shared_ptr<node> prev;
47  };
48 
49  persistent_stack(std::shared_ptr<node> head, uint64_t size);
50 
51  std::shared_ptr<node> head_;
52  uint64_t size_;
53 };
54 }
55 }
56 
58 
59 #endif
Definition: persistent_stack.h:41
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
Definition: persistent_stack.h:34
Definition: persistent_stack.h:21