Add log and shared_ptr snippets to cpp