diff --git a/src/base/trie.hh b/src/base/trie.hh index a75e9e7353..71a14c55cb 100644 --- a/src/base/trie.hh +++ b/src/base/trie.hh @@ -31,16 +31,27 @@ #include #include +#include #include "base/cprintf.hh" #include "base/logging.hh" #include "base/types.hh" -// Key has to be an integral type. +/** + * A trie is a tree-based data structure used for data retrieval. It uses + * bits masked from the msb of the key to to determine a value's location, + * so its lookups have their worst case time dictated by the key's size. + * + * @tparam Key Type of the key of the tree nodes. Must be an integral type. + * @tparam Value Type of the values associated to the keys. + */ template class Trie { protected: + static_assert(std::is_integral::value, + "Key has to be an integral type"); + struct Node { Key key;