mardi 26 mai 2020

I wonder why `std::unique_ptr

I wonder why std::unique_ptr<int> foo (new int) is legal.

I think the input argument type should be int in std::unique_ptr<int>. But the type new int is int*.

I am a novice in C++. I thought it over and over but I still could not get the idea. Could anybody make it clear for me? Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire