12 ms·
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
by ridiculous_fish 5y ago
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.
- deleted 5y ago[deleted]
- cma 5y agoThat 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.