Using std::make_unique with a custom deleter

The whole point of make_unique is to encapsulate the notion of “use new to create a T from given constructor arguments and use delete to destroy it”.

If you wanted a custom deleter, you would also have to specify how to create the object, and then there would be nothing more gained from having the emplacing maker function.

I wrote some examples of custom maker functions for certain unique resource handles in this post.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)