C++ weak cache