Ponder the use of unique_ptr to enforce the Rule of Zero—Marco Arena

Save to:
Instapaper Pocket Readability

Marco Arena points out an important difference between shared_ptr and unique_ptr regarding polymorphic deletion. The article also shows two ways to equip unique_ptr with a type-erased deleter, one with no usage of dynamic dispatching.

Ponder the use of unique_ptr to enforce the Rule of Zero

by Marco Arena

I read the article "Enforcing the Rule of Zero" from latest Overload (of ACCU) and I'd like to point out something that I misapprehended at a first reading. ... a clever point the author underlines is about polymorphic deletion: what to do when we want to support polymorphic deletion, or when our classes have virtual functions? ...

Then the author suggests to use a shared_ptr: ...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.