24 lines
496 B
C++
24 lines
496 B
C++
#include <inttypes.h>
|
|
#include <string>
|
|
#include <queue>
|
|
|
|
|
|
template<typename T> struct tree_node{
|
|
struct tree_node* child;
|
|
struct tree_node* brother;
|
|
std::string id;
|
|
T* data;
|
|
};
|
|
|
|
|
|
template<typename T> class NonBinTree{
|
|
public:
|
|
NonBinTree(T* data);
|
|
void add_url(std::string url, T* handler);
|
|
T* get_url(std::string url);
|
|
private:
|
|
void add_tree_node(std::queue<std::string> path, T* data);
|
|
T* get_tree_node(std::queue<std::string> path);
|
|
tree_node<T> *root = new tree_node<T>;
|
|
};
|