A memoization pattern in C++ 11.