Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

You can use a custom deleter, e.g.

    struct deleter_t { void operator()(impl_t *); };
    using impl_unique_ptr_t = std::unique_ptr<impl_t, deleter_t>;

You can place the implementation of the deleter alongside the impl.


view as:

That breaks make_unique. Maybe unique_ptr inside an std::any? Error-prone casting, but managed lifetime. Though make_unique is maybe obsolete now that parameter evaluation order is better defined.

Legal | privacy