Blender Git Loki
Git Commits -> Revision b90fec5
Revision b90fec5 by Jacques Lucke (master) May 13, 2021, 12:14 (GMT) |
BLI: simplify supporting heterogeneous lookup for new types Heterogeneous lookup is useful when constructing a key in a map/set is relatively expensive (e.g. `std::string`). When doing lookups in the map/set, one usually does not want to construct the type to avoid overhead. Instead, heterogeneous lookup allows for using a different type (such as `StringRef`) as key. This change makes it easier to implement heterogeneous lookup for custom types. Before, one had to specialize `blender::DefaultHash`. Now, one just has to implement a `static uint64_t hash_as(value)` on the type itself. One still has to provide the equality operator in addition to the hash function of course. |
Commit Details:
Full Hash: b90fec5d46624d40f35764de629a0e28e7478101
Parent Commit: 23a788b
Lines Changed: +19, -3
1 Modified Path:
/source/blender/blenlib/BLI_hash.hh (+19, -3) (Diff)