lundi 27 août 2018

std::unique_ptr

In Modern Effective C++, "Iterm 19: Use std::shared_ptr for shared-ownership resource management.", Page 133-134, it says

std::shared_ptr supports derived-to-base pointer conversions that make sense for single objects, but that open holes in the type system when applied to arrays. (For this reason, the std::unique_ptr API prohibits such conversions.)

What's the meaning of "open holes in the type system"?

Why whould std::unique_ptr<T[]> API prohibit derived-to-base pointer conversions?

And how coult it prohibit the conversions?

Aucun commentaire:

Enregistrer un commentaire