samedi 28 octobre 2017

What is the purpose of a raw pointer to unique_ptr function parameter in C++?

Skimming through the TensorFlow C++ API I stumbled upon a strange function signature:

Status Create(
     const FileSystemStoragePathSourceConfig & config,
     std::unique_ptr< FileSystemStoragePathSource > *result
)

I don't understand why result is a raw pointer to unique_ptr. Because usually when we want to pass unique_ptr as a function parameter we do it either by means of move (&&) or by value & or by copy. I haven't seen the use case of a raw pointer to unique_ptr before.

Aucun commentaire:

Enregistrer un commentaire