3 ms·
It's almost like a RangeMap, of which there are at least 3 notable variations: * The basic RangeMap, where a range of adjacent keys all map to the same value
by o11c 2y ago
It's almost like a RangeMap, of which there are at least 3 notable variations:
* The basic RangeMap, where a range of adjacent keys all map to the same value
* The computed RangeMap, where a range of adjacent keys all map to adjacent values (common for e.g. case-conversion of Unicode, can also come up for IP addresses)
* The DenseMap, where a range of adjacent keys map to arbitrary values, but use an array for memory optimization.
The first two actually can be made to work for string-like keys. The last is only possible for integer-like keys; use a carefully chosen trie design for string-like keys.