c++ related snippet