Template Function sequant::cache_manager(meta::eval_node_range auto const&, size_t)

Function Documentation

template<bool force_hash_collisions = false>
auto sequant::cache_manager(meta::eval_node_range auto const &nodes, size_t min_repeats = 1)

Make a cache manager from an iterable of evaluable nodes.

See also

CacheManager

Parameters:
  • nodes – An iterable of eval nodes.

  • min_repeats – Minimum number of repeats for a node to be cached. By default (1) everything is cached, so use-count tracking is exact. Pass 2 to cache only nodes reached more than once, which caches less and leaves the use counts approximate. Either way registration costs O(1) per cached node: the cache keys on the nodes’ addresses and copies none of them.

Returns:

A cache manager. Its keys point into nodes, which must outlive it with its nodes in place (see CacheManager); the overload below takes a temporary forest and has the cache hold it.