Template Struct CachedValueHasher

Struct Documentation

template<meta::eval_node Node, bool force_hash_collisions = false>
struct CachedValueHasher

Hasher for CachedValue: the node’s canonical hash, i.e. byte-identical to TreeNodeHasher.

Public Types

using is_transparent = void

Public Functions

inline std::size_t operator()(CachedValue<Node> const &cv) const
inline std::size_t operator()(Node const &n) const

Heterogeneous overload: probe the map with a bare node. Without it every lookup would convert the node to a CachedValue first, and that conversion copies the node &#8212; which deep-copies its whole subtree (binary_node.hpp), so probing a deep left-leaning Sum-tree would cost O(terms^2) node allocations. The hash is the node’s canonical hash either way.