copy-on-write by shared_ptr