Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.62 KB | None | 0 0
  1. #ifndef PERSISTENT_BIN_TREE_SUPER_TREE_H
  2. #define PERSISTENT_BIN_TREE_SUPER_TREE_H
  3.  
  4. #include "node.h"
  5. #include<memory>
  6.  
  7. //#define const_iterator node*
  8. //#define MAX_STRING "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
  9. const std::string MAX_STRING = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
  10. struct set {
  11.  
  12. public:
  13.     set();
  14.     set(set const &);
  15.     set(node const &);
  16.  
  17.     ~set();
  18.  
  19.     set & operator= (const set &);
  20.  
  21.     bool empty() const;
  22.  
  23.     void erase (value_type const&);
  24.     void insert (value_type const&) ;
  25.     bool contains (value_type const&) const;
  26.  
  27. private:
  28.     std::shared_ptr<node> erase (std::shared_ptr<node>, value_type);
  29.     std::shared_ptr<node> insert (std::shared_ptr<node>, value_type const&);
  30.     std::shared_ptr<node> find (std::shared_ptr<node>,  value_type const&) const;
  31.     std::shared_ptr<node> minimum (std::shared_ptr<node>) const;
  32.     std::shared_ptr<node> maximum (std::shared_ptr<node>) const;
  33.     std::shared_ptr<node> next (std::shared_ptr<node>, value_type const) const;
  34.     std::shared_ptr<node> prev (std::shared_ptr<node>, value_type const) const;
  35.     std::shared_ptr<node> root;
  36.     size_t size_ = 0;
  37. };
  38. #endif //PERSISTENT_BIN_TREE_SUPER_TREE_H
  39.  
  40. #ifndef PERSISTENT_BIN_TREE_NODE_H
  41. #define PERSISTENT_BIN_TREE_NODE_H
  42. #include<string>
  43. #include <memory>
  44. //#define value_type std::string
  45. typedef std::string value_type;
  46.  
  47. struct node {
  48.     node();
  49.     node(value_type);
  50.     node(node const &);
  51.     node& operator= (const node&);
  52.     std::shared_ptr<node> left;
  53.     std::shared_ptr<node> right;
  54.     value_type val;
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement