Examples

Lazy config loader

Parse a key = value file exactly once, on first access, and cache the map. reset() forces a reload — the hook you would wire to a SIGHUP handler.

Lazy config loader
Read walkthrough
SINGLE_THREADEDLAZYCONFIG
Argument-sensitive cache

Wrap a slow recursive Fibonacci. operator()(n) returns the cached result for a repeated n and re-runs the callable the moment n changes — one argument slot, not a map.

Argument-sensitive cache
Read walkthrough
SINGLE_THREADEDCACHEARGUMENTS
Thread-safe one-time init

Sixteen threads race to initialise one device. make_memoized<lock_free> lets exactly one run the initialiser; the rest block on it and observe the same cached handle.

Thread-safe one-time init
Read walkthrough
LOCK_FREETHREADSMAKE_MEMOIZED