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.
Jan (1) [Avatar] Offline
#3
Suppose I have the implementation of an expensive free function used all over my code in some source file.
How can I use make_memoized without changes outside of said source file?
My naive implementations give me a std::bad_alloc.