Universal Memoization Decorator
summary
A generic C++ decorator implements universal memoization by turning a function into a cached callable using a key built from decayed arguments and a container with get/set semantics (get returns pointer or null, set updates). It relies on a function-pointer-as-template-value trick so each instantiation gets a static cache per-instantiation, supports decorating recursive functions, and allows interchangeable containers (hash maps, LRU) plus concurrency strategies like mutexes or thread_local copies.
AI-written summary · about
chapters (7)
- 0:00Intro
- 0:28Python
- 1:06Cache container
- 2:04What about collisions?
- 2:59Building the decorator
- 4:11Fibonacci Example
- 4:24What's left behind
related talks
47mReducing Template Compilation Overhead, Using C++11, 14, 17, and 20.
01h 03mModern C++ Development: Limitations and Problems in std::function and Similar Constructs
02h 32mIntroduction to Decorators: Power UP Your Python Code
01h 02mHow to Hide C++ Implementation Details
17mMemo: an incremental computation library that powers Dune
41mDecorators in Depth
01h 00mThe hidden rules of world-class C++ code
02h 21mIntroduction to Decorators: Power Up Your Python Code
