diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-02-19 10:05:45 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 10:18:33 +0100 |
commit | ecd15e3f6731a8298e9cd3ebc45e1875e8c19063 (patch) | |
tree | d976a5fd710cc39350a37a2aa2f37fd08d0926f5 /trie.h | |
parent | No idea, to tired. (diff) | |
download | calp-ecd15e3f6731a8298e9cd3ebc45e1875e8c19063.tar.gz calp-ecd15e3f6731a8298e9cd3ebc45e1875e8c19063.tar.xz |
Now it links, but segfaults.
Diffstat (limited to 'trie.h')
-rw-r--r-- | trie.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -3,25 +3,25 @@ #include <iostream> -template <typename T> +template <class T> struct trie_node { char c; T* value = NULL; trie_node<T>* next = nullptr; trie_node<T>* child = nullptr; - trie_node (char c); + trie_node (char c) : c(c) { }; trie_node (char c, trie_node<T>* next, trie_node<T>* child); }; template <class T> std::ostream& operator<<(std::ostream&, trie_node<T>* node); -template <typename T> +template <class T> struct trie { trie_node<T>* root; - trie (); + trie () : root (new trie_node<T> ('\0')) { } int push_back (const char* key, const T&); |