C++ code snippets