samedi 15 janvier 2022

After calling the reset method on a unique pointer object, I am able to use the object without getting an access violation error

As you below sample code, I am trying to use a unique pointer not give an error

int main()
{
    auto a = make_unique<TestClass>();
    a->Print();
    a.reset();
    a->Print();// this method call is still working
}

Aucun commentaire:

Enregistrer un commentaire