A small cache for each character of a word and an associated value, such as iterator into a trie for each character.
More...
|
| FlatCharValueMap (const FlatCharValueMap &) |
|
FlatCharValueMap & | operator= (const FlatCharValueMap &) |
|
const Value * | lookup (const std::string_view &word, std::size_t &consumed) |
| Retrieve the cached value for a word. More...
|
|
void | append (const char key, const Value &value) |
| Add a mapping from a char key to value . More...
|
|
void | append (const char key, Value &&value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
void | clear () |
| Clears the cache.
|
|
template<class Value>
class utility::FlatCharValueMap< Value >
A small cache for each character of a word and an associated value, such as iterator into a trie for each character.
Really this exists to overcome a potential performance limitation of the interface by which the dictionary solvers plug into the solver algorithm, where they would otherwise have to find their position again every iteration from scratch. However, for some iterations, the stem of the word is still the same, as the solver performs a breadth first search.
A different interface for the solver dictionaries to implement may help this, or simply storing more state on the solvers. What I'd really like is c++20 coroutines, allowing the solver dictionaries to write a tradional for loop style solver that would keep all the appropriate state in scope managed by the coroutine.