C++ useful codes