I have a function that returns a reference to a std::promise:
std::shared_ptr<std::promise<void>> foo();
The caller can then catch the value and wait on the future:
auto this_future = foo()->get_future();
this_future.wait();
Does it make sense to return a reference to the promise, or should I return the future instead, so that the calling function does not have to call get_future()?
Aucun commentaire:
Enregistrer un commentaire