Replace deprecated auto_ptr with unique_ptr.