sanjaykhan (4) [Avatar] Offline
#1
In listing 6.7 ("Function that creates a memoized wrapper from a function pointer"), should the cache variable be static?
Ivan Cukic (54) [Avatar] Offline
#2
No. The lifetime of the cache is tied to the lifetime of the lazy variable.

There are a few solutions that use a static cache, which I'll provide links to, but it is not something that this implementation needs.