Re:Cttrie – Compile-time trie-based string matching for C++
by kllrnohj on Friday September 14, 2018 @04:53PM
(#17990840)
Hash collisions would be one obvious problem with this approach. You could likely always tweak the hash used in response to collisions on the set of constants, but that's not going to be fun the first time it happens.
Also with that approach since it can't be made into a jump table it's still going to compile into a bunch of if/else combinations. At least with the trie it can early-return if the input doesn't have any chance of matching anything.
Also with that approach since it can't be made into a jump table it's still going to compile into a bunch of if/else combinations. At least with the trie it can early-return if the input doesn't have any chance of matching anything.