In this code:
void f(std::unique_ptr<int> q)
{
}
void g()
{
std::unique_ptr<int> p{new int{42}};
f(std::move(p));
}
At which line p is deallocated? I'd say at the exit of the f function because it was moved there using std::move, but I'm not sure nor confident about this answer.
Aucun commentaire:
Enregistrer un commentaire