some cpp snippets