C++ memozation class