Some C++ code snippets