diff --git a/trie.h b/trie.h index 3a178be..aa64d2b 100644 --- a/trie.h +++ b/trie.h @@ -11,6 +11,7 @@ class trie { void insert(std::string, T); bool exist(std::string); bool empty(); + iterator begin(); private: tnode* root; int size; diff --git a/trie.hpp b/trie.hpp index 333799b..00819ca 100644 --- a/trie.hpp +++ b/trie.hpp @@ -1,6 +1,7 @@ #include #include "_trie_util.h" +#include "_trie_iterator.h" template trie::trie(): size(0) { @@ -55,3 +56,9 @@ template bool trie::empty() { return this->size == 0; } + +template +typename trie::iterator trie::begin() { + trie_iterator it = *(new trie_iterator(this->root)); + return ++it; +}