If the unique pointer constructor is explicit why is it possible to assign it to make_unique<T>()?

Viewed 190

I understand that because of the explicit keyword in the constructor of unique_ptr the following will throw an error:

std::unique_ptr<int> p = new int()

That is because we are relying on implicit conversion. To make it work we would need to explicitly call the constructor as follows:

std::unique_ptr<int> p(new int())

But I am confused why does the following work:

std::unique_ptr<int> p = std::make_unique<int>();

We are not calling the constructor explicitly. Isn't this also a type of implicit conversion?

0 Answers
Related